Skip to content

fix(ci): make docs-governance fork-PR safe under actions/checkout v7#5885

Merged
jamesarich merged 1 commit into
meshtastic:mainfrom
jamesarich:fix/docs-governance-fork-pr-ci
Jun 20, 2026
Merged

fix(ci): make docs-governance fork-PR safe under actions/checkout v7#5885
jamesarich merged 1 commit into
meshtastic:mainfrom
jamesarich:fix/docs-governance-fork-pr-ci

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

Why

actions/checkout@v7 refuses to check out fork PR code from a pull_request_target workflow (the "pwn request" guard). docs-governance.yml runs all three of its jobs on pull_request_target and checks out the fork's head.sha, so every fork PR now fails the Docs quality gates check at the checkout step (e.g. #5856). The two staleness jobs are currently masked only because they're dismissed by skip-docs-check / skip-preview-check labels — they carry the same latent failure.

🛠️ What

Split the workflow by trust level instead of opting into the unsafe flag:

  • validate (Docs quality gates) now runs on pull_request. It must check out and execute fork-supplied code (node scripts/*.js); under pull_request the token is read-only and secrets are unavailable, so that execution is safe. It is skipped on pull_request_target.
  • staleness / preview-staleness stay on pull_request_target (they need the write token to post advisory comments) but no longer check out fork code — they read the changed-file list via gh pr diff --name-only. No fork code is fetched or executed.

This deliberately avoids allow-unsafe-pr-checkout: true, which would run fork-controlled scripts with the base write token and secrets (RCE).

Notes

  • Effect is realized once merged to main: pull_request_target jobs use the base workflow immediately; the validate check runs for a fork PR after it next merges main (the pull_request trigger comes from the PR head's copy).
  • validate's doc checks never actually ran before (they died at checkout); this lets them run. Any real doc-link/coverage failures they surface are separate from this infra fix.

Testing Performed

  • actionlint passes (only a pre-existing SC2129 shellcheck style note in untouched code).

🤖 Generated with Claude Code

actions/checkout@v7 refuses fork checkout under pull_request_target
(pwn-request guard), failing the 'Docs quality gates' check on every
fork PR. Split docs-governance by trust level:

- validate (Docs quality gates) -> pull_request (fork context, read-only
  token, no secrets) so it can safely check out + run fork node scripts.
- staleness / preview-staleness stay on pull_request_target for the write
  token but no longer check out fork code; they read the changed-file list
  via 'gh pr diff --name-only'.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added bugfix PR tag repo Repository maintenance labels Jun 20, 2026
@jamesarich jamesarich merged commit bc86134 into meshtastic:main Jun 20, 2026
18 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag repo Repository maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant