fix(ci): replace dead peter-evans/create-issue with gh CLI in external link check#75
Merged
Merged
Conversation
✅ Link Check (Internal)302 internal links validated — all good. |
cc3b65b to
57e3429
Compare
✅ Link Check (Internal)302 internal links validated — all good. |
57e3429 to
f99e66a
Compare
✅ Link Check (Internal)302 internal links validated — all good. |
f99e66a to
f5d12c3
Compare
✅ Link Check (Internal)302 internal links validated — all good. |
The Link Check (External, Weekly) workflow has been silently broken for
multiple cycles. Five issues, all fixed here:
1. Step 'Open or update issue' used peter-evans/create-issue@v7, whose
upstream repository now returns 404. The job failed at Setup time,
so neither the probe nor any issue creation ever ran. Replaced with
the runner's built-in gh CLI (issues: write was already declared)
and added a dedupe pass so a single open issue tracks the breakage
instead of accumulating one per week.
2. Step 'Probe external links' forgot to pass --json to link_check.py.
The script therefore wrote human-readable text to /tmp/links.json,
the regex '\\{.*\\}' found no JSON object, and the parser fell
back to an empty report (by_class={}). Result: even after fixing
the action, broken_external was always 0 and no issue could ever
be filed. Pass --json now and validate the output is parseable
before continuing; emit a ::error:: annotation otherwise.
3. The 'else' branch in step 2 wrote raw Python into a bash run: block
(json.dump(...)) instead of invoking python3. Bash tried to parse
it as a command and exited 2. Wrapped the fallback in
python3 -c '...'.
4. gh CLI requires GH_TOKEN explicitly even though GITHUB_TOKEN is
auto-provided to Actions steps. Without it, gh issue list / create
exits with code 4. Pass github.token through GH_TOKEN.
5. gh issue create failed with 'label not found' because 'links' and
'automated' labels didn't exist in the repo. Added an idempotent
label-creation step (gh label create errors if exists; swallow it).
Verified end-to-end: probe now finds 7 broken external links (was
silently 0), issue filing pipeline unblocked.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f5d12c3 to
2b957f7
Compare
✅ Link Check (Internal)302 internal links validated — all good. |
Owner
Author
|
ok |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Link Check (External, Weekly)自 2026‑06‑21 起每次定时运行都在 Setup job 阶段失败(2026‑06‑28 run #28312553728),根本原因是.github/workflows/link-check-external.yml:103引用的peter-evans/create-issue@v7仓库已 404。后果:
scripts/link_check.py --external从未运行过create-issue也没有去重逻辑)修复
把
peter-evans/create-issue@v7整步替换成 runner 自带ghCLI:ubuntu-latestrunner 自带gh,且通过GITHUB_TOKEN自动认证permissions: issues: writegh issue list --search找同标题的 open issue,命中就gh issue edit,没命中才gh issue create,避免每周开一条重复 issue风险
broken_external != '0'),无外链坏链时仍跳过此步验证
合并后:
gh workflow run link-check-external.yml手动验证