Skip to content

fix(ci): merge Dependabot PRs directly instead of via --auto - #104

Merged
dantech2000 merged 1 commit into
mainfrom
auto-merge-direct
Jul 29, 2026
Merged

fix(ci): merge Dependabot PRs directly instead of via --auto#104
dantech2000 merged 1 commit into
mainfrom
auto-merge-direct

Conversation

@dantech2000

Copy link
Copy Markdown
Owner

Follow-up to #99. That fixed attribution; this fixes the merge actually succeeding.

The error

GraphQL: Auto merge is not allowed for this repository (enablePullRequestAutoMerge)
$ gh api repos/dantech2000/refresh --jq '{allow_auto_merge}'
{"allow_auto_merge": false}

GitHub's auto-merge feature is disabled on this repo, so gh pr merge --auto only ever worked by accident — when a PR happened to be fully green and mergeable at that instant, gh merged it directly; otherwise the call errored. That's precisely the observed mix of success and failure runs, and why #82#95 piled up with autoMerge=no.

Why not just enable the repo setting

Because there's no branch protection, so there are no required status checks. Repo-wide auto-merge would merge any PR the moment it became mergeable, whether or not CI had run — a footgun well beyond Dependabot.

We don't need it. The two wait-for-check gates already block until Run go test and Run golangci-lint report success, and the merge step's if requires both conclusions to be success. By the time execution reaches the merge, checks have demonstrably passed. A direct merge is equivalent in safety, and it fails loudly on conflict instead of queueing silently forever.

Evidence the combined fix works

commit how merged workflows triggered
ab21bd1 (#99) manually, as a user Test, Lint, Release Please
37f1d0f (#100) auto-merged, old token none ❌

#99's GH_PAT gives correct attribution; this PR makes the merge call succeed in the first place. Together the full path works: bump merged as a real user → Test/Lint/Release Please fire on mainfix(deps) cuts a patch release.

Verification

command: gh pr merge ${{ ... }} --squash --delete-branch
has --auto flag: False
token: ${{ secrets.GH_PAT }}

The real proof is the next Dependabot PR: it should merge cleanly, and the resulting main commit should show Test, Lint, and Release Please runs.

The merge step failed for most Dependabot PRs:

  GraphQL: Auto merge is not allowed for this repository
  (enablePullRequestAutoMerge)

GitHub's auto-merge feature is disabled on this repo (allow_auto_merge=false),
so `gh pr merge --auto` only ever worked by accident: when a PR happened to be
fully green and mergeable at that moment, gh merged it directly, and otherwise
the call errored. That is exactly the observed mix of success and failure runs,
and why #82-#95 piled up unmerged with autoMerge=no.

Enabling the repo setting is the other possible fix, and it is the worse one.
There is no branch protection here, so there are no REQUIRED status checks --
repo-wide auto-merge would merge any PR the moment it became mergeable,
regardless of whether CI had run. That is a footgun well beyond Dependabot.

We do not need it. The two wait-for-check gates above already block until
"Run go test" and "Run golangci-lint" report success, and the step's `if`
requires both. By the time we reach the merge, the checks have demonstrably
passed, so a direct merge is equivalent in safety -- and it fails loudly on
conflict rather than queueing silently forever.

Combined with GH_PAT from ab21bd1, the full path now works: bump merged as a
real user -> Test/Lint/Release Please fire on main -> `fix(deps)` cuts a patch
release. Verified that ab21bd1 (merged manually as a user) triggered Lint, Test
and Release Please, while 37f1d0f (auto-merged under the old token) triggered
none.
@dantech2000
dantech2000 merged commit 20e704f into main Jul 29, 2026
5 checks passed
@dantech2000
dantech2000 deleted the auto-merge-direct branch July 29, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant