Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

*: check connectivity of external links via GitHub action #353

Merged
merged 30 commits into from
Sep 7, 2020
Merged
Changes from 15 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6074146
*: check link via GitHub action
csuzhangxc Sep 7, 2020
520806b
*: exclude to `media`
csuzhangxc Sep 7, 2020
8e2dc46
*: debug liche
csuzhangxc Sep 7, 2020
7ceef22
*: debug liche
csuzhangxc Sep 7, 2020
bde59d5
*: debug liche
csuzhangxc Sep 7, 2020
9f31ed3
*: debug liche
csuzhangxc Sep 7, 2020
82a5d2f
*: update args for liche
csuzhangxc Sep 7, 2020
c4801f0
Fail if there were link errors
csuzhangxc Sep 7, 2020
4a6c2a1
*: fix env
csuzhangxc Sep 7, 2020
9c7d070
*: try hardcode doc root
csuzhangxc Sep 7, 2020
4f4b712
*: update doc root
csuzhangxc Sep 7, 2020
e31d5f0
*: decrease concurrency to avoid "HTTP error 429"
csuzhangxc Sep 7, 2020
7e606e9
*: decrease concurrency again
csuzhangxc Sep 7, 2020
5a6ba35
*: decrease concurrency to 4; add some notes
csuzhangxc Sep 7, 2020
090fc15
*: exclude "https://github.com/pingcap/dm/pull/.*"
csuzhangxc Sep 7, 2020
6e5e6a1
*: do not show OK
csuzhangxc Sep 7, 2020
6802163
*: try update reg
csuzhangxc Sep 7, 2020
2390174
*: debug reg
csuzhangxc Sep 7, 2020
e285726
*: debug reg
csuzhangxc Sep 7, 2020
43bfd08
*: add echo
csuzhangxc Sep 7, 2020
01c1c68
*: exlude .md files
csuzhangxc Sep 7, 2020
2c902b0
Update .github/workflows/link-check.yaml
csuzhangxc Sep 7, 2020
780ec38
Update .github/workflows/link-check.yaml
csuzhangxc Sep 7, 2020
6b2ead5
Update .github/workflows/link-check.yaml
csuzhangxc Sep 7, 2020
c308e0e
Update .github/workflows/link-check.yaml
csuzhangxc Sep 7, 2020
0e290e0
Update .github/workflows/link-check.yaml
csuzhangxc Sep 7, 2020
0918796
Merge branch 'master' into link-check
csuzhangxc Sep 7, 2020
7628193
fix an external link; update ci.yaml
Sep 7, 2020
81661a9
test ci
Sep 7, 2020
97af4bc
Revert "test ci"
Sep 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/link-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: link-check

on: [pull_request]

jobs:
base:
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v2

# NOTE:
# - the check process can be very fast,
# but if `-c` is too large then `Too Many Requests (HTTP error 429)` may be reported from `https://github.com/*`.
# - we hardcode `--document-root` to `/github/workspace` in the container now.
# - we use `http://172.*` as sample addresses in some docs, so we need to exclude them.
- name: Link check for zh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新 workflow 的功能是内链(相对链接)和外链(绝对链接)都会查吗 @csuzhangxc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的。但不能正确检测出锚文本

Copy link
Contributor

@yikeke yikeke Sep 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

内链 和 内链锚文本 的检查都已经有了,在 ci.yaml 的 Verify links 和 Verify link anchors 两个 step 中实现了。学程哥新加的这个可以配置成只检查 外链 吗

Copy link
Contributor

@yikeke yikeke Sep 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果方便的话,最好把检查外链的这个 action 也写到 ci.yaml 那个文件里,写成和 Verify links、Verify link anchors 并列的一个新的 step,就不要另起一个 workflow 了,怎么样? @csuzhangxc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

想的是单开一个 workflow,不是 Required。这样检查异常时,也还是能 merge?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,这样的话也可以,就不必因为 pr 未涉及的 404 外链而 block merge 了

uses: peter-evans/link-checker@v1
with:
args: -c 32 -d /github/workspace -r -v -x '(http://172.*|https://github.com/pingcap/dm/pull/.*)' zh*

- name: Link check for eh
id: lc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请教下,上面的「Check external links in zh files」那一步没有 id,如果只有 zh 有 error、en 没有 error,下面的 ${{ steps.lc.outputs.exit_code }} 会是 1 吗? @csuzhangxc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

啊。我的错误,都需要加 id、都需要判断

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯嗯,学程哥帮忙提个 pr 改下?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#370 PTAL

uses: peter-evans/link-checker@v1
with:
args: -c 32 -d /github/workspace -r -v -x '(http://172.*|https://github.com/pingcap/dm/pull/.*)' en*

- name: Fail if there were link errors
run: exit ${{ steps.lc.outputs.exit_code }}

# Debug via SSH if previous steps failed
#- name: Set up tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v2