Repository navigation
feat(dependabot-auto-merge): gate the workflow_run path on every required workflow - #94
Merged
Merged
Conversation
…ired workflow A workflow_run trigger fires once per workflow, so the first one to go green merged the PR while the others were still running, and on private Free-plan repos nothing else stops it. Eleven callers had copied the same inline gate job to fix that. Move it here as `required-workflows` (and `optional-workflows` for path-filtered ones): a separate gate job checks each listed workflow's run for the PR's head commit and fails closed. The gate job declares no permissions, so only callers that use it need to grant actions: read; with the inputs empty, nothing changes for anyone. tests/dependabot-gate.test.sh runs the gate script verbatim against a fake gh (13 cases), wired into self-test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Summary
Moves the Dependabot merge gate into this reusable, so its eleven copies become one tested implementation.
Why: on the
workflow_runpath, the trigger fires once per workflow, so the first workflow to go green merged the PR while the others were still running. Callers on the defaultpull_request+--autopath were worse off: on private Free-plan repos there are no required checks, so--automerged at once. On 2026-11-13, sproncy-website-scrapers #646 merged 11 seconds after its CI started, with tests failing, and brokemain. Eleven Sproncy and HordiaLabs repos now carry an identical inlinegatejob to work around this.New inputs (both default empty):
required-workflows: workflow filenames that must all have a successfulpull_requestrun for the PR's head commit.optional-workflows: path-filtered workflows. No run, orskipped, is fine; anything else must succeed.How:
gatejob that runs only whenrequired-workflowsis set, on theworkflow_runpath, for Dependabot. It fails closed: a missing required run, a running, failed, cancelled or skipped one, or an API error blocks the merge.gatedeclares no permissions, so it inherits the caller's job grant. Only callers that use it addactions: read. A permission declared in the reusable would be required from every caller, which would break the existing ones.auto-mergenow hasneeds: gateand analways()guard. It runs if the gate was skipped (inputs empty, or thepull_requestpath) or passed. Its own permissions and steps are unchanged.Backward compatible: with the inputs empty,
gateis skipped andauto-mergebehaves as before, so this can go out as a minor release (3.8.0).Docs:
examples/README.md: the Free-plan stub now shows the gate, thebranchesfilter,concurrency, andpermissions: {}plus job grants.CHANGELOG.md: an[Unreleased]entry.Tests
tests/dependabot-gate.test.shextracts the gate'srun:block verbatim and runs it against a fakegh, the same approach asplaintext-scan.test.sh. It has 13 cases: all passed, newline-separated input, failed, running, missing, skipped and cancelled required runs, a query error, missing, skipped, failed and running optional runs, and a name-prefix case. It is wired intoself-test.yml.After merging
v3.8.0.release.ymlmovesv3and publishes the notes.required-workflows/optional-workflows, deleting their inline gate job. One PR each.🤖 Generated with Claude Code