Skip to content

fix(ci): replace dead peter-evans/create-issue with gh CLI in external link check#75

Merged
Sphinxes0o0 merged 1 commit into
mainfrom
sphinxes0o0-fluffy-winner
Jun 28, 2026
Merged

fix(ci): replace dead peter-evans/create-issue with gh CLI in external link check#75
Sphinxes0o0 merged 1 commit into
mainfrom
sphinxes0o0-fluffy-winner

Conversation

@Sphinxes0o0

Copy link
Copy Markdown
Owner

问题

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 从未运行过
  • 即使扫描出真坏链,也不会开 issue 跟踪(之前 create-issue 也没有去重逻辑)
  • 周巡形同虚设

修复

peter-evans/create-issue@v7 整步替换成 runner 自带 gh CLI:

  • ubuntu-latest runner 自带 gh,且通过 GITHUB_TOKEN 自动认证
  • workflow 已有 permissions: issues: write
  • 顺手补 dedupe:先 gh issue list --search 找同标题的 open issue,命中就 gh issue edit,没命中才 gh issue create,避免每周开一条重复 issue
  • 同时删掉了对单一第三方 action 的隐性依赖,未来同类问题不会卡住整个工作流

风险

  • 低:仅替换 issue 创建步骤,外链探测/解析/summary 三步未动
  • 触发条件未变(broken_external != '0'),无外链坏链时仍跳过此步

验证

合并后:

  • 下周日 04:00 UTC 自动跑
  • 或立刻 gh workflow run link-check-external.yml 手动验证

@github-actions

Copy link
Copy Markdown

✅ Link Check (Internal)

302 internal links validated — all good.

@Sphinxes0o0 Sphinxes0o0 force-pushed the sphinxes0o0-fluffy-winner branch from cc3b65b to 57e3429 Compare June 28, 2026 07:26
@github-actions

Copy link
Copy Markdown

✅ Link Check (Internal)

302 internal links validated — all good.

@Sphinxes0o0 Sphinxes0o0 force-pushed the sphinxes0o0-fluffy-winner branch from 57e3429 to f99e66a Compare June 28, 2026 07:28
@github-actions

Copy link
Copy Markdown

✅ Link Check (Internal)

302 internal links validated — all good.

@Sphinxes0o0 Sphinxes0o0 force-pushed the sphinxes0o0-fluffy-winner branch from f99e66a to f5d12c3 Compare June 28, 2026 07:30
@github-actions

Copy link
Copy Markdown

✅ 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>
@Sphinxes0o0 Sphinxes0o0 force-pushed the sphinxes0o0-fluffy-winner branch from f5d12c3 to 2b957f7 Compare June 28, 2026 07:32
@github-actions

Copy link
Copy Markdown

✅ Link Check (Internal)

302 internal links validated — all good.

@Sphinxes0o0

Copy link
Copy Markdown
Owner Author

ok

@Sphinxes0o0 Sphinxes0o0 merged commit 29730ba into main Jun 28, 2026
4 checks passed
@Sphinxes0o0 Sphinxes0o0 deleted the sphinxes0o0-fluffy-winner branch June 28, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant