Repository navigation
feat(dependabot-auto-merge): opt-in major gate - #191
Merged
Merged
Conversation
Add an allow_major input (boolean, default false). When a caller sets it, a single-dependency major bump outside trusted_namespaces no longer stops at "manual review". The job waits until every check on the PR head SHA has finished, required or not, then merges directly with --match-head-commit. Callers that leave the input unset take exactly the old paths; the new steps run only on decision=major-gate. Why a new gate instead of --auto: --auto waits only on required checks, and most fleet repos require only standards-check. A red build does not stop it, and an armed auto-merge survives a Dependabot rebase. How the gate decides: - Any fail or cancel: leave for manual review, naming the checks. - SKIPPED and NEUTRAL do not block (Netlify's "Pages changed"). - Passes only after a settle wait and two identical all-finished polls, with at least one other check green. Checks such as Netlify's appear minutes after the PR opens. - Must see its own check run. The token has no checks permission, and the job cannot ask for one without breaking callers that do not grant it, so a blank list on a private repo becomes manual review, not a false "all green". - Head moved, unreadable output, or 40 minutes elapsed: manual review. Every exit is a ::notice::, never a red check (the #87 rule). Grouped PRs are unchanged. Trusted-namespace majors keep the --auto path. The job gains timeout-minutes: 50 to bound the wait. The header comment said --auto merges "only after all status checks pass". That is wrong; it now says required checks only. The header and README also note that security updates bypass Dependabot cooldown, so an allow_major repo can merge a security-driven major on day 0. tests/test-dependabot-auto-merge.sh extracts the two inline run: blocks with yq and runs them against a stub gh (17 cases). Mutating the self-visibility, allow_major, two-poll, and cancel conditions each makes it fail. Advances smartwatermelon/dev-env#120
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.
Advances smartwatermelon/dev-env#120 (phase 1: the release valve for majors).
What changes
New caller input
allow_major(boolean, defaultfalse). With it on, a single-dependency major bump outsidetrusted_namespacesmerges without a human, but only through a stricter gate than patch/minor:decision=major-gate(one dependency, both versions parse, majors differ).failorcancelleaves the PR for manual review and names the checks.SKIPPED/NEUTRALdo not block.--match-head-commit <sha>. It does not use--auto.Unchanged: callers that leave the input unset, grouped PRs, unparseable versions, and trusted-namespace majors (they keep the
--autopath). The new steps run only ondecision=major-gate.Why not
--autofor majorsgh pr merge --autowaits only on required checks. Measured today on main:Code standards & build (24), netlify-site-checks, 4 Netlify checks, standards-check, auto-mergeA red
buildis not required in three of the four repos, so it does not stop--auto. Auto-merge also stays armed across a Dependabot rebase, and the new head is then judged by required checks only. The header comment said--automerges "only after all status checks pass"; that was wrong and now says required checks only.How the gate avoids a false "all green"
checks: read, and it cannot request one: a called job that requests a permission its caller did not grant fails validation for every caller. On a private repo the check list may come back blank. The gate therefore requires that it can see its own check run, and skips if it cannot. Private-repo opt-in may need a later contract that addschecks: readand updates callers.::notice::, never a red check (the dependabot-auto-merge is inert in 29/51 fleet repos: can_approve_pull_request_reviews unset by installer #87 rule). The job getstimeout-minutes: 50.Open question, not decided here
Security updates bypass Dependabot
cooldown. Per GitHub's docs, cooldown applies to version updates only. A security-driven major can open on day 0, and withallow_major: trueit merges as soon as every check is green. The workflow cannot tell whether a cooldown elapsed. Also, the docs listsemver-major-daysas not supported forgithub-actions; that ecosystem gets onlydefault-days.Testing
tests/test-dependabot-auto-merge.sh(17 cases). It extracts the policy and gaterun:blocks withyqand runs them against a stubgh. Four deliberate mutations (self-visibility,allow_major, the two-poll rule, cancel counting) each make it fail.bash tests/run-tests.sh: all 8 files pass.bash standards/run-standards.sh --repo .: clean.actionlint,zizmor, andshellcheck -S infoare clean, with no suppressions added.Release
No tags were moved. Per README "Rollout discipline", pin 2–3 pilots to a new exact tag before moving
dependabot-auto-merge-v2. Moving v2 also picks up two comment-only commits already on main (#180, #188).allow_majoris an error on any ref that lacks it, so callers can set it only after the tag ships.