Repository navigation
ci: decide auto-merge when fetch-metadata fails, and leave it alone in a run for an older head - #65
Merged
Conversation
fetch-metadata fails on a Dependabot pull request whose first commit is no longer a verified Dependabot commit, for example after someone else rebases it. The deciding step was then skipped, so `auto-merge`, a required check, failed and the pull request could not be merged by hand either. The metadata step now continues on error and the deciding step reads its outcome: on a failure it warns, keeps auto-merge off (turning off one an earlier head enabled) and passes. dependabot-auto-merge-test.sh checks the two step settings and three cases of a failed metadata step.
A run for an older head that ran after the run for the newer head read the commits of the newer head, found them ineligible for its own head and turned off the auto-merge the newer run had enabled. The deciding step now reads the head of the pull request together with the auto-merge state and changes nothing when the head is no longer the one its event named, and the runs for one pull request share a concurrency group, so they run one at a time. dependabot-auto-merge-test.sh checks the concurrency group and five cases of a moved or unreadable head or a failing read.
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
Fixes two ways
.github/workflows/dependabot-auto-merge.ymlfails. A review of semnil/koe-zukan#62, which adds the same workflow, found them; the same fix goes to every repository of semnil that has this workflow.auto-mergefailed and the pull request could not be merged by hand either. fetch-metadata fails when the first commit of a Dependabot pull request is no longer a verified Dependabot commit, for example after someone else rebases it; this happened on build(deps): Bump pyee from 14.0.0 to 15.0.0 analyze-spectrum#100 (run 39769440764, 2026-10-22). Now the metadata step continues on error and the deciding step reads its outcome: on a failure it warns, keeps auto-merge off (turning off one an earlier head enabled) and passes.dependabot-auto-merge-<number>. In the auto-merge runs on Dependabot branches of the 13 repositories with this workflow (170 runs, 139 pairs of an older and a newer head, read from the Actions API on 2026-10-25), no older run was still running when the newer one started.Changes
.github/workflows/dependabot-auto-merge.yml:continue-on-erroron the metadata step and its outcome passed to the deciding step asMETADATA_OUTCOME(e89f437); the concurrency group and the head comparison before turning auto-merge off (74a10b4)..github/tests/dependabot-auto-merge-test.sh: checks the step settings and the concurrency group, answers the head from the fake gh, and adds the cases of a failed metadata step (e89f437) and of a moved or unreadable head or a failing read (74a10b4).Verification
At
74a10b4:.github/tests/dependabot-auto-merge-test.sh: 51 checks, 0 failed. Against the workflow ofaeaaf23: 51 checks, 35 failed.actionlint1.7.12 on the changed workflow: no findings (on the whole directory it stops at lines of other workflows this pull request does not change).shellcheckon the test: no findings..github/tests/workflow-checks-test.sh: 34 cases, 0 failed, 0 skipped.61e81b2,bdb728b), where each of 8 mutations of the workflow makes the test fail.Measured on GitHub
On a private probe repository, semnil/auto-merge-probe (pull request 1, 2026-10-25), the job of
.github/workflows/dependabot-auto-merge.ymlas semnil/koe-zukan#62 merged it ran with two changes: its steps ran for a pull request semnil opened, so fetch-metadata failed on it, and a 45-second wait sat between the metadata step and the deciding step. Heads A, B and C were pushed at 01:22:17Z, 01:22:31Z and 01:22:43Z.PR is not from Dependabot, nothing to do.), its step concludedsuccess, the deciding step ran withMETADATA_OUTCOME: failureand warnedfetch-metadata did not classify this pull request (failure), so auto-merge stays off, and the job concludedsuccess.the head of the pull request is now 27435858646bfc5628cf11daecb9c745c090f1e0, so the run for that head decidesand called nogh pr merge.Canceling since a higher priority waiting request for dependabot-auto-merge-1 exists); the run for C started at 01:23:20Z, after the run for A ended at 01:23:18Z. A control workflow with the same wait and no concurrency group ran its three runs overlapping (01:22:27–01:23:16Z, 01:22:38–01:23:26Z, 01:22:49–01:23:37Z).allow_auto_merge=trueset on the probe reads backfalse). Thegh pr merge --disable-autocall itself has run on GitHub: build(deps): Bump pyee from 14.0.0 to 15.0.0 analyze-spectrum#100 showsauto_merge_disabledbygithub-actions[bot]at 2026-10-22T11:12:20Z, and the branch that reaches it after a failed metadata step is a case of the test above.Not measured yet