Repository navigation
ci: gate Dependabot auto-merge on full CI and breaking/danger checks - #28
Merged
Merged
Conversation
Dependency auto-merge version 2. A Dependabot patch/minor update is merged only when every other check on the PR head commit is green and the new dependency gate (.github/scripts/dependency-gate.mjs, byte-identical in all plugin repositories, dependency-free, 24 node:test tests with fixture lockfiles) finds nothing breaking or dangerous. Otherwise the PR gets the needs-review label and a comment with the reasons. Majors keep the major-update label and are never merged automatically. - surface job (read-only, runs PR code): builds merge base and head and records the npm pack file list, exports, peerDependencies, engines and the exports of the built entries. - gate job (trusted, script from the default branch, data only): engines, peerDependencies and peer floor, 0.x runtime minors, breaking-change wording, surface diff, dependency-review-action (moderate, license allowlist), npm audit signatures, install scripts, >15 new packages, non-registry or integrity-less resolutions. - merge job: waits for all workflow runs, check runs and statuses on the head SHA (two green polls, 75 min timeout), then merges with --match-head-commit. - CI runs the gate unit tests; docs describe the gate. Docs read (2026-11-19): GitHub Actions events (pull_request, workflow_run), Dependabot on Actions, GITHUB_TOKEN permissions, secure use; dependabot/fetch-metadata v3.1.0; dependency-review-action v5.0.0 (action.yml, README, src/main.ts, src/licenses.ts, src/purl.ts); upload-artifact v7, download-artifact v8; npm audit signatures (docs and npm 10.9.8 source); REST workflow runs, check runs, combined status, dependency-graph compare; gh pr merge --match-head-commit (gh 2.103.3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodeQL js/incomplete-sanitization flagged replace('@', ...). npm names
carry at most one leading @, so the result was already correct; make
the intent explicit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Dependency auto-merge, version 2
Dependabot updates are merged automatically only when nothing dangerous or breaking is in them, and only after the full CI is green on the PR head commit. Identical logic in all eight plugin repositories:
.github/scripts/is byte-identical, and so is everything independency-auto-merge.ymlexcept this repository's ownverifyjob and theNPM_CI_FLAGSvalue.What changes
.github/scripts/dependency-gate.mjs: dependency-free gate script (subcommandspolicy,surface,decide,route,wait-ci,review-changes), withdependency-gate.test.mjs(24node --testtests, fixture lockfiles infixtures/) and a local.prettierrc.jsonso the same bytes pass Prettier in every repository..github/workflows/dependency-auto-merge.yml: theverifyjob is unchanged (except that the actor must also bedependabot[bot]); new jobssurface,gateandmerge.ci.yml/test.yml): new step "Dependency gate unit tests".Merge mechanism: wait for every check on the head commit, then merge that exact commit
The
mergejob polls the REST API for the head SHA (workflow runs, check runs, commit statuses), excludes this workflow's own runs, takes the latest run per workflow and event, and needs two green polls in a row (timeout 75 minutes). Then it runsgh pr merge --squash --delete-branch --match-head-commit <sha>, so a newer push can never be merged unverified. A failing check, or a timeout, holds the PR.Why not
workflow_run: it fires once per finished workflow, so the merge decision would have to be rebuilt from several events. It runs the default-branch file with a write token and finds the PR only through the head SHA or an artifact from the PR run (the pattern GitHub warns about), and the decision would no longer be tied to the same run as the gate. Polling inside the same run keeps gate, wait and merge bound to one head SHA. The cost is one runner that waits while CI runs.Hold reasons (label
needs-reviewand a comment, never merged)Breaking-change guard:
engines: a changed package'sengines.node(lockfile and, for direct dependencies,npm view) drops a Node version the plugin's ownengines.nodesupports.peer,peer-floor: new or raisedpeerDependenciesthat the installed tree does not satisfy, or (for shipped packages) that exceed the plugin's peer floor.breaking-text: the PR body or release notes mention a breaking change.surface: the published surface differs between merge base and head:npm pack --dry-runfile list (chunk hashes normalized),exports/main/files,peerDependencies,engines, static exports of every entry file, runtime export shape of every CommonJS entry.zero-minor: a runtimedependenciesentry on 0.x gets a minor bump (or a 0.0.x patch bump).Danger guard:
vulnerability,license,dependency-review:actions/dependency-review-action(v5.0.0,fail-on-severity: moderate, all scopes) plus the same check in the script on the dependency-graph comparison: advisories of moderate or higher, licenses outside the allowlist (MPL-2.0 and CC-BY for development dependencies only; reviewed exceptions for@strapi/*, sharp's LGPL binaries,npm,json-schema,normalize-package-data). The allowlist was checked against all eight current trees.signatures:npm audit signaturesfails (missing or invalid registry signatures or provenance attestations).install-script,new-packages,registry,integrity: the lockfile adds a package withhasInstallScript, adds more than 15 package names that are new to the tree, or resolves a changed package outsidehttps://registry.npmjs.org/or without a sha512 integrity hash.Also held:
verifyorgatefailed, an empty or unknown Dependabotupdate-type, failing CI, CI timeout. Majors (Dependabotupdate-typeor a direct dependency major in the lockfile) keep themajor-updatelabel and comment as before.Security
sparse-checkout: .github/scripts), never from the PR.surfacejob runs PR code (install with--ignore-scripts, thennpm run build), with the read-only token and no secrets; its report is parsed as data.gatejob installs with--ignore-scriptsonly (fornpm audit signatures) and holds the token withcontents: read.contents,pull-requests) and the read scopes for the CI wait (actions,checks,statuses) are on themergejob only, which checks out no PR code.pull_request.user.login == 'dependabot[bot]'andgithub.actor == 'dependabot[bot]', so they are skipped for every other PR (including this one) and for human pushes to a Dependabot branch.Evidence
node --test .github/scripts/dependency-gate.test.mjs: 24 tests, every hold reason and the pass path.npm audit signatureson the head install): decisionmergefor all three;wait-cion their head commits returnssuccess.engines,install-script,registry,breaking-text,vulnerability,license,dependency-review,signatures.actionlint1.7.12 with shellcheck 0.11.0: no findings on all workflows.npm audit signaturespasses on all eight current trees; the license allowlist passes on all eight dependency graphs.Docs read
pull_request,workflow_run), Dependabot on Actions (read-only token,permissionskey),GITHUB_TOKENpermissions, secure use (SHA pinning, untrusted input).action.yml, README andsrc/main.ts,src/licenses.ts,src/purl.ts; actions/upload-artifact v7 and download-artifact v8 READMEs.audit signatures(docs and installed npm 10.9.8 source: needs the installed tree, exit 1 on missing or invalid).head_sha), check runs for a ref, combined status, dependency-graph compare;gh pr merge --match-head-commit(gh 2.103.3).Needs the owner
needs-reviewandmajor-updatewere created in the repository.mainandallow_auto_merge=false: the gate does not depend on them. Branch protection with required checks would add a second barrier for human merges.Commit type
ci:: no release.🤖 Generated with Claude Code