Fix the two reasons auto-merge has never merged anything - #3
Merged
Conversation
The first live run, on lemma#2, showed the workflow never auto-merges a grouped update at all. fetch-metadata leaves update-type empty for a group - a group has no single type - and the condition read only that field. Seven documentation dependencies in one PR went to a human, and would have done so even if all seven were patches. That is the group most worth merging unattended, and grouping is why dependabot.yml groups at all. updated-dependencies-json carries one entry per dependency with its own updateType. The decision now requires every entry to be a patch, and moves into its own step with a reason string so the log says why. Every branch that does not positively establish a patch ends at auto=false: a misread refuses rather than merges.
The five red Dependabot pull requests across the organisation are all this one line: failed to create review: GitHub Actions is not permitted to approve pull requests. (addPullRequestReview) The organisation does not allow Actions to approve pull requests. Under bash -e that call took the whole step down before gh pr merge --auto was ever reached, so nothing was ever queued. The approval was never needed. Branch protection requires the CI check and no reviews, and auto-merge waits on the check either way. If a review requirement is ever added this needs a token that is not GITHUB_TOKEN.
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.
What this changes
Two defects in the auto-merge workflow, both found by running it rather than by
reading it. Nothing it was supposed to do has ever worked.
1. It could not merge anything at all
Every Dependabot pull request opened since the workflow landed is red on the
same line:
This organisation does not allow Actions to approve pull requests. The step ran
gh pr review --approvebeforegh pr merge --auto, and underbash -ethefailed approval took the whole step down — so the merge was never queued. Five
red pull requests across five repositories, all this.
The approval was never needed. Branch protection here requires the
CIcheckand no reviews. It is removed rather than retried or made non-fatal, because a
step that "succeeds" after failing its first command is the kind of thing nobody
reads again.
2. It never auto-merged a grouped update
Its one clean run, on lemma#2 —
seven dependencies in one grouped pull request:
update-typeis empty for a group, because a group has no single update type.The condition read only that field, so every grouped bump fell through to "needs
a human" — even one where all seven were patches. That is the group most worth
merging unattended, and grouping is why
dependabot.ymlgroups at all.updated-dependencies-jsoncarries one entry per dependency with its ownupdateType. The decision now requires every entry to be a patch, and movesinto its own step with a reason string so the run log says why.
Verified
The decision logic was extracted and run against nine cases:
update-typeliterally the stringnullNot yet verified: the exact shape of
updated-dependencies-jsonfrom a realgrouped pull request. The field is documented and its entries carry
updateType, but the first genuine test is the next Dependabot run. If it iswrong, the failure mode is refusing to merge — today's behaviour, not a bad
merge.
What breaks if this is wrong
Every branch that does not positively establish "patch" ends at
auto=false, soa misread refuses rather than merges.
jqis preinstalled onubuntu-latest.Separately worth knowing:
dependabot/fetch-metadata@v2now warns that Node 20is deprecated, and Dependabot has opened a v3 bump. That is a major version of
the action this logic reads its inputs from, so it is deliberately left to be
reviewed on its own rather than folded in here.
The file is generated from one template across all six repositories that carry
it, so they cannot drift the way this version did.