diff --git a/.github/workflows/link-pr.yml b/.github/workflows/link-pr.yml new file mode 100644 index 0000000..61b8f16 --- /dev/null +++ b/.github/workflows/link-pr.yml @@ -0,0 +1,40 @@ +name: links when pr + +on: + pull_request: + branches: [ main ] + paths: + - '**.md' + - '.lycheeignore' + +jobs: + linkChecker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: "latest" + + - name: Build + run: hugo --minify + + - name: Link Checker + uses: lycheeverse/lychee-action@v1.5.0 + with: + fail: true + # For parameter description, see https://github.com/lycheeverse/lychee#commandline-parameters + # -E, --exclude-all-private Exclude all private IPs from checking. + # -i, --insecure Proceed for server connections considered insecure (invalid TLS) + # -n, --no-progress Do not show progress bar. + # -t, --timeout Website timeout in seconds from connect to response finished [default:20] + # --max-concurrency Maximum number of concurrent network requests [default: 128] + # -a --accept Comma-separated list of accepted status codes for valid links + + # ./site the MkDocs site directory to check + # ./*.md all markdown files in the root directory + args: -E -i -n -t 45 --max-concurrency 64 -a 429,401 -- 'public' '*.md' + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/link.yml b/.github/workflows/link.yml new file mode 100644 index 0000000..9f9203f --- /dev/null +++ b/.github/workflows/link.yml @@ -0,0 +1,51 @@ +name: links + +on: + repository_dispatch: + workflow_dispatch: + schedule: + - cron: "30 8 * * *" + +jobs: + linkChecker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Download Exclude Path + run: | + curl https://raw.githubusercontent.com/gocn/How-To-Code-in-Go/main/.lycheeignore --output .lycheeignore + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: "latest" + + - name: Build + run: hugo --minify + + - name: Check Links + uses: lycheeverse/lychee-action@v1.5.0 + with: + # For parameter description, see https://github.com/lycheeverse/lychee#commandline-parameters + # -E, --exclude-all-private Exclude all private IPs from checking. + # -v, --verbose Verbose program output + # -i, --insecure Proceed for server connections considered insecure (invalid TLS) + # -n, --no-progress Do not show progress bar. + # -t, --timeout Website timeout in seconds from connect to response finished [default:20] + # --max-concurrency Maximum number of concurrent network requests [default: 128] + # -a --accept Comma-separated list of accepted status codes for valid links + + # ./site the MkDocs site directory to check + # ./*.md all markdown files in the root directory + args: -E -v -i -n -t 45 --max-concurrency 64 -a 429,401 -- 'public' '*.md' + output: out.md + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: Create Issue From File + uses: peter-evans/create-issue-from-file@v3 + with: + title: Broken Link Detected + content-filepath: out.md +# assignees: aFlyBird0 diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.lycheeignore @@ -0,0 +1 @@ + diff --git a/README.md b/README.md index 6586cef..6d641fa 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ 贡献者(按昵称首字母排序): -> [astaxie](https://github.com/astaxie) | [Cluas](https://github.com/Cluas) | [cvley](https://github.com/cvley) | [Fivezh](https://github.com/fivezh) | [iddunk](https://github.com/iddunk) | [lsj1342](https://github.com/lsj1342) | [watermelon](https://github.com/watermelo) | [小超人](https://github.com/ddikvy) | [Xiaomin Zheng](https://github.com/zxmfke) | [Yu Zhang](https://github.com/pseudoyu) | [朱亚光](https://github.com/zhuyaguang) +> [astaxie](https://github.com/astaxie) | [Cluas](https://github.com/Cluas) | [cvley](https://github.com/cvley) | [Fivezh](https://github.com/fivezh) | [iddunk](https://github.com/iddunk) | [lsj1342](https://github.com/lsj1342) | [watermelon](https://github.com/watermelo) | [小超人](https://github.com/focozz) | [Xiaomin Zheng](https://github.com/zxmfke) | [Yu Zhang](https://github.com/pseudoyu) | [朱亚光](https://github.com/zhuyaguang) 安装完 `hugo` 之后,需要先同步主题文件 @@ -137,7 +137,7 @@ The articles in 《How-To-Code-in-Go》 are licensed under a [Creative Commons A - + dijkvy
小超人 @@ -158,4 +158,4 @@ The articles in 《How-To-Code-in-Go》 are licensed under a [Creative Commons A
- \ No newline at end of file + diff --git a/content/zh/_index.md b/content/zh/_index.md index aabe133..8535ba3 100644 --- a/content/zh/_index.md +++ b/content/zh/_index.md @@ -9,7 +9,7 @@ type: docs 贡献者(按昵称首字母排序): -> [astaxie](https://github.com/astaxie) | [Cluas](https://github.com/Cluas) | [cvley](https://github.com/cvley) | [Fivezh](https://github.com/fivezh) | [iddunk](https://github.com/iddunk) | [lsj1342](https://github.com/lsj1342) | [watermelon](https://github.com/watermelo) | [小超人](https://github.com/ddikvy) | [Xiaomin Zheng](https://github.com/zxmfke) | [Yu Zhang](https://github.com/pseudoyu) | [朱亚光](https://github.com/zhuyaguang) +> [astaxie](https://github.com/astaxie) | [Cluas](https://github.com/Cluas) | [cvley](https://github.com/cvley) | [Fivezh](https://github.com/fivezh) | [iddunk](https://github.com/iddunk) | [lsj1342](https://github.com/lsj1342) | [watermelon](https://github.com/watermelo) | [小超人](https://github.com/focozz) | [Xiaomin Zheng](https://github.com/zxmfke) | [Yu Zhang](https://github.com/pseudoyu) | [朱亚光](https://github.com/zhuyaguang) 安装完 `hugo` 之后,需要先同步主题文件 @@ -70,4 +70,4 @@ hugo server ## 授权 -The articles in 《How-To-Code-in-Go》 are licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). \ No newline at end of file +The articles in 《How-To-Code-in-Go》 are licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). diff --git a/static/README.md b/static/README.md index 1255ecf..6b4bcee 100644 --- a/static/README.md +++ b/static/README.md @@ -4,7 +4,7 @@ 贡献者(按昵称首字母排序): -> [astaxie](https://github.com/astaxie) | [Cluas](https://github.com/Cluas) | [cvley](https://github.com/cvley) | [Fivezh](https://github.com/fivezh) | [iddunk](https://github.com/iddunk) | [lsj1342](https://github.com/lsj1342) | [watermelon](https://github.com/watermelo) | [小超人](https://github.com/ddikvy) | [Xiaomin Zheng](https://github.com/zxmfke) | [Yu Zhang](https://github.com/pseudoyu) | [朱亚光](https://github.com/zhuyaguang) +> [astaxie](https://github.com/astaxie) | [Cluas](https://github.com/Cluas) | [cvley](https://github.com/cvley) | [Fivezh](https://github.com/fivezh) | [iddunk](https://github.com/iddunk) | [lsj1342](https://github.com/lsj1342) | [watermelon](https://github.com/watermelo) | [小超人](https://github.com/focozz) | [Xiaomin Zheng](https://github.com/zxmfke) | [Yu Zhang](https://github.com/pseudoyu) | [朱亚光](https://github.com/zhuyaguang) 安装完 `hugo` 之后,需要先同步主题文件 @@ -65,4 +65,4 @@ hugo server ## 授权 -The articles in 《How-To-Code-in-Go》 are licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). \ No newline at end of file +The articles in 《How-To-Code-in-Go》 are licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/).