From 49d19af0791de2b41cba9515051e7defdc324244 Mon Sep 17 00:00:00 2001 From: junqi-lu Date: Thu, 13 Jul 2023 21:30:18 +0800 Subject: [PATCH] doc(readme): add FAQ fix: #21 --- README-zh.md | 16 +++++++++++++--- README.md | 12 ++++++++++-- template/main.yml | 2 ++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/README-zh.md b/README-zh.md index a94a6aa1..0839b070 100644 --- a/README-zh.md +++ b/README-zh.md @@ -27,7 +27,7 @@ 本小节所示的安装方法可以满足大多数人的需求,你只需要在你的 `.github.io` 仓库中新建三个配置文件,即可开始使用,具体步骤如下: ``` bash .github - |- workflow + |- workflows |- custom.js # 项目配置文件 |- cv.md # 简历模板配置文件 |- main.yml # github actions 配置文件 @@ -74,14 +74,14 @@ git push origin -u source ``` #### `repoConfig` -构建出的静态页面推送配置,其中 `repo` 和 `owner` 应与 `vssueConfig` 中保持一致,`pushBranch` 保留为 `master` 即可,`email` 填写为你的 Github 账号绑定的邮箱,用于填写 commit message。 +构建出的静态页面推送配置,其中 `repo` 和 `owner` 应与 `vssueConfig` 中保持一致,`pushBranch` 保留为主分支即可(github之前的默认主分支是 `master`,现在是 `main` ),`email` 填写为你的 Github 账号绑定的邮箱,用于填写 commit message。 如果你不想让其他人发布的 issue 出现在你的主页,可以在 `filterUsers` 字段设置用户 ID 白名单,若设置为空或者不设置,则表示任何人发布的 issue 都会被发布出来。 ```js { repo: String, // same as vssueConfig.repo owner: String, // same as vssueConfig.owner - pushBranch: String, // which branch to deploy static pages, default is 'master' + pushBranch: String, // which branch to deploy static pages, default is 'master' or 'main' email: String, // your email of github account, just for commit message filterUsers: Array // filter issues according to github account ids } @@ -168,6 +168,16 @@ yarn run dev ### 1. 如果防止别人发布的 issue 出现在我的主页? 你可以配置 `repoConfig.filterUsers` 字段来设置白名单。 +### 2. 更新配置代码时,github action未自动执行? + +你可以检查仓库的 `.github/workflows/main.yml` 下 `on->push->branches` 是否是你代码变动的分支。默认该配置为 `master`, +但是现在 github 的默认分支为 `main`。 + +### 3. 可以成功执行 github action, 但是仓库代码未更新并添加静态页面文件? + +请查看 github action 的日志,确认 GITHUB_TOKEN 是否拥有写的权限,若没有,请参考 [GITHUB_TOKEN官方文档](https://docs.github.com/zh/actions/security-guides/automatic-token-authentication),在 `.github/workflows/main.yml` 文件中赋予对仓库的读写权限。 +模板 [`./template/main.yml`](./template/main.yml) 默认赋予所有读写权限。 + ## 鸣谢 - 本项目基于 [vuepress](https://vuepress.vuejs.org/) 开发。 - 网页计数功能由 [busuanzi](http://busuanzi.ibruce.info/) 提供。 \ No newline at end of file diff --git a/README.md b/README.md index c4213a9c..a95993b7 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Below are just some of the methods for installing ISSUE BLOG. Do not follow all ### Simple Installation (without Fork) ``` bash .github - |- workflow + |- workflows |- custom.js # site config |- cv.md # resume config |- main.yml # github actions config @@ -77,7 +77,7 @@ Config for push repo, here is the example: { repo: String, // same as vssueConfig.repo owner: String, // same as vssueConfig.owner - pushBranch: String, // which branch to deploy static pages, default is 'master' + pushBranch: String, // which branch to deploy static pages, default is 'master' or 'main' email: String, // your email of github account, just for commit message filterUsers: Array // filter issues according to github account ids } @@ -154,6 +154,14 @@ You can refer [vuepress doc](https://vuepress.vuejs.org/) for more details. ### 1. How to prevent others from publishing issues to the site? You can set a white-list by setting `repoConfig.filterUsers` to `['Your Github ID', 'Another Friend's ID']`, default setting allows everyone to post a blog to your site. +### 2. When updating the configuration, why GitHub Actions did not automatically run? + +You can check the `.github/workflows/main.yml` file in your repository and ensure that the `on->push->branches` section corresponds to the branch where your code changes are made. Default branch was `master`, but now is `main` on GitHub. + +### 3. GitHub Actions run successfully, but the repository code is not updated, and static page files are not added? + +Please check the logs of your GitHub Actions and verify if the `GITHUB_TOKEN` has write permissions. If it does not, please refer to the [official documentation about GITHUB_TOKEN](https://docs.github.com/zh/actions/security-guides/automatic-token-authentication) and grant read and write permissions to your repository in `.github/workflows/main.yml`. Template file [`./template/main.yml`](./template/main.yml) define read or write access for all of the available scopes. + ## Acknowledgment - This project is based on [vuepress](https://vuepress.vuejs.org/). - Visitor report is powered by [busuanzi](http://busuanzi.ibruce.info/). diff --git a/template/main.yml b/template/main.yml index 6d8439f3..876e10d1 100644 --- a/template/main.yml +++ b/template/main.yml @@ -21,6 +21,8 @@ jobs: build: runs-on: ubuntu-latest + permissions: write-all + strategy: matrix: node-version: [19.x]