ci(dependabot): make auto-merge work on private free-plan repos#30
Merged
Conversation
Replace the single `gh pr merge --auto` job with the visibility-agnostic label + workflow_run pattern. GitHub native auto-merge is unavailable on private free-plan repos, so `--auto` silently failed and Dependabot PRs piled up. The new flow: a `label` job (pull_request_target) runs fetch-metadata and tags low-risk PRs (gomod patch, github_actions patch/minor) with `dependabot-automerge`; a `merge` job (workflow_run after CI succeeds) does a plain `gh pr merge --squash`, which needs no native auto-merge and works on private and public repos alike. The merge job's workflow_run gates on the exact CI workflow name `CI`. Both jobs gate on `pull_request.user.login == 'dependabot[bot]'`, not `github.actor`, so human-triggered rebases stay eligible. Grouped updates are still safe: fetch-metadata reports the highest semver bump, so the update-type gate keeps majors out. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Why
GitHub's native auto-merge (
gh pr merge --auto) is unavailable on private repos on the free plan. The olddependabot-auto-merge.ymlrelied on it, so on this private repo--autosilently failed and low-risk Dependabot PRs piled up in the review queue with nothing merging them.What
Replace the single
auto-mergejob with the visibility-agnostic label + workflow_run pattern:label(pull_request_target) — runsdependabot/fetch-metadata, then tags low-risk PRs with thedependabot-automergelabel:merge(workflow_run, after theCIworkflow succeeds) — does a plaingh pr merge --squashon the labeled Dependabot PR. A plain squash merge needs no native auto-merge, so it works on private and public repos alike.Safety
github.event.pull_request.user.login == 'dependabot[bot]', notgithub.actor— a human@dependabot rebasemakes the actor the commenter while the PR author stays Dependabot, so the actor check would wrongly fail.gomod-patch= patch only,actions= patch + minor). For grouped PRs fetch-metadata reports the highest semver bump in the group, so gating onupdate-typekeeps majors out even when a group collapses several bumps into one PR.mergejob'sworkflow_run.workflowsis pinned to the exact CI workflow nameCI, which already triggers onpull_request— so the merge job fires only after green CI.🤖 Generated with Claude Code