ci: adopt the canonical dependabot auto-merge reusable - #448
Merged
Conversation
Replaces 55 lines of locally-copied auto-merge logic with a pinned call to forkwright/.github's reusable. The copy is how this repo's version drifted: it kept `exit 0` on the refusal path long after the canonical workflow had corrected it to `exit 1`, so the guard printed "refusing auto-merge" and then merged. #372 fixed that instance; this removes the copy that produced it. Adoption was blocked until forkwright/.github#38: the reusable matched osv by exact suffix, and this repo's job is named `osv-scanner`, which matched neither spelling it tested for — adopting then would have refused every PR whose osv check had reported and passed. That is fixed. The reusable now normalises check names to lowercase alphanumerics and tests containment, and all four tokens it requires resolve here: `gate / gate` to gategate, `cargo deny` to cargodeny, `cargo audit` to cargoaudit, and `osv-scanner` to osvscanner, which contains osvscan. The caller keeps two things the reusable does not supply, and both are recorded inline because both look like inconsistencies with gate-attestation.yml and are not. It declares a concurrency block, which gate-attestation.yml deliberately omits. The difference is in the reusables: hybrid-gate.yml declares its own group, so a caller-level duplicate self-cancels it; this one declares none, so without a caller-level block a superseded push to a dependabot PR leaves the earlier run racing the newer one, both waiting on checks and both able to merge. It does not pass `secrets: inherit`, which gate-attestation.yml does. That keyword forwards every repository secret to a workflow in another repository, and this reusable reads `secrets.GITHUB_TOKEN` and nothing else — which a called workflow receives regardless. Inheriting would widen the blast radius of a change in forkwright/.github for no capability gained. Closes#371
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 freeto 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.
Closes#371
Replaces 55 lines of locally-copied auto-merge logic with a pinned call to the canonical reusable in
forkwright/.github.The copy is how this repo's version drifted. It kept
exit 0on the refusal path long after thecanonical workflow had corrected it to
exit 1— so the guard printed "refusing auto-merge" and thenmerged, because Actions skips a later step only when an earlier one fails. #372 fixed that
instance; this removes the copy that produced it, which is what the issue actually asked for.
Why this was blocked, and why it no longer is
The reusable used to match the osv check by exact suffix, testing for names ending in
osv scanneror
osv-scan. This repo's job is namedosv-scanner, which ends with neither — so adopting thenwould have made auto-merge refuse every PR whose osv check had reported and passed.
forkwright/.github#38 replaced that with normalisation: strip every non-alphanumeric, lowercase, test
containment. All four tokens the reusable requires resolve here:
gateattestation/gategategate / gategategate✓cargodenycargo denycargodeny✓cargoauditcargo auditcargoaudit✓osvscanosv-scannerosvscannercontains it ✓Those four are exactly the required contexts on
mainplus the gate, so the reusable is checking thesame set branch protection does — with the addition it was adopted for: it verifies the checks
reported at all, which branch protection cannot, since a required check that silently never
reports is not a failure it can see.
Two deliberate differences from
gate-attestation.ymlBoth are commented inline, because both look like inconsistencies and neither is.
This caller declares
concurrency;gate-attestation.ymldeliberately does not. The differenceis in the reusables.
hybrid-gate.ymldeclares its own group, so a caller-level duplicateself-cancels it. This one declares none — so without a caller-level block, a superseded push to a
dependabot PR leaves the earlier run racing the newer one, both waiting on checks and both able to
merge.
This caller does not pass
secrets: inherit;gate-attestation.ymldoes. That keyword forwardsevery repository secret to a workflow in another repository. This reusable reads
secrets.GITHUB_TOKENand nothing else, which a called workflow receives regardless — so inheritingwould widen the blast radius of a change in
forkwright/.githubfor no capability gained.Verification
pre-push-verify.shderives the crates a branch touches from its diff; this branch touches none, sothere is nothing for it to build. The verification that matters here is GitHub resolving the
uses:ref and the reusable's own jobs reporting, which only CI can do. The YAML was parsed locally to rule
out a malformed file before pushing.
The refusal path itself is exercised by the next dependabot PR rather than by this one — this PR is
not authored by
dependabot[bot], so the job'sif:correctly skips it. Worth watching the firstdependabot bump after this lands to confirm the guard fails rather than skips on a red check.