Repository navigation
ci: bring the main-source guard to main (bootstrap for #5119) - #5122
Conversation
…erge The guard (#5119, PR #5120 on v2/main) runs on pull_request_target, which loads the workflow and script from main. Bring the same three files here byte-for-byte, so the check can run on, and be required for, PRs into main before the next milestone merge carries them. Part of #5119 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
|
There was a problem hiding this comment.
🟢 Approval recommended
The guard is fail-closed, securely avoids executing PR code, and matches #5120 byte-for-byte.
0 open findings
What changed in this PR
Bootstraps main with the trusted source guard needed to enforce pure merges from v2/main.
Changes:
- Adds a
pull_request_targetworkflow for PRs intomain. - Adds fail-closed ancestry verification.
- Adds Git-history and workflow-security tests.
| File | Description |
|---|---|
.github/workflows/main-source.yml |
Runs the read-only source guard. |
scripts/verify-main-source.mjs |
Verifies the PR head exists on v2/main. |
scripts/verify-main-source.test.mjs |
Tests guard behavior and workflow safety. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Part of #5119
Part of, notCloses: this PR targetsmain, the default branch, where a closing keyword would close #5119 at merge, before #5120 lands onv2/main.Description
A one-off bootstrap. It brings the three files of the Source is v2/main guard from #5120 to
main, byte-for-byte:.github/workflows/main-source.ymlscripts/verify-main-source.mjsscripts/verify-main-source.test.mjsThe guard runs on
pull_request_target, which loads the workflow and script frommain. Until they are onmain, the check cannot run on (or be required for) any PR intomain. Docs changes stay on #5120 and reachmainwith the next milestone merge.This is a deliberate one-time exception to "only milestone merges target
main", made on the maintainer's decision, before the rule that enforces it exists. The guard itself would reject this PR, but it cannot run here (see above).Server Details
None (repository-wide): CI and a root script.
Motivation and Context
#5119; the rationale and review are on #5120.
How Has This Been Tested?
main+ the three files):npm ci && npm run validate:guards, exit 0. That covers every script test, including the 12 for the guard, plus the workflow guards (verify:action-pins, the workflow timeout and local-script rules).verify:dco -- --base origin/main --head HEAD: 1 commit, signed off.cmp).git merge-tree --write-tree <this head> <#5120 head>gives exactly ci: guard main so a PR into it brings nothing not already on v2/main #5120's tree (88bd7a36), so thereleaseskill's tree-equality check still passes once both have merged. Keep it that way: if ci: guard main so a PR into it brings nothing not already on v2/main #5120 changes these files, this PR is updated to match before it merges.main(one atorigin/v2/main, expected to pass; one with a commit of its own, expected to fail) probe the live check before it is made required.Breaking Changes
None.
Types of changes
Checklist
pull_request_targetwith no PR code checked out or run, read-only tokenMerge with "Create a merge commit", the only method
mainnow allows.🤖 Generated with Claude Code