ci: auto-merge patch and minor Dependabot updates - #639
Draft
rrrutledge wants to merge 1 commit into
Draft
Conversation
Adds a workflow that approves Dependabot PRs and enables GitHub's native auto-merge for patch and minor version updates, so they merge on their own once branch protection is satisfied. Major updates still open a normal PR for review. This is inert until a maintainer enables "Allow auto-merge" on the repo and requires the CI checks on the main branch, so auto-merge waits for green before merging. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqiXti3H1onRAb3esyV1Dg
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 does
Adds
.github/workflows/dependabot-auto-merge.yml, which approves a Dependabot PR and turns on GitHub's native auto-merge for patch and minor version updates. GitHub then merges the PR on its own once branch protection is satisfied. Major-version updates are left alone and still open a normal PR for a human to review.Important: this workflow is inert until two repo settings are in place
The workflow only requests auto-merge. GitHub will not actually merge anything until a maintainer applies both of these (they need admin, so they are not part of this PR):
gh pr merge --autohas nothing to enable.main. Settings → Branches → themainprotection rule → Require status checks to pass before merging, and add the checks that must be green (e.g. theSpelling & Styles/ vale job, and CodeQL). This is what makes auto-merge wait for green instead of merging as soon as the PR is approved.Until step 2 is in place, auto-merge would merge a PR the moment it has the one required approval, without waiting for CI - so step 2 is the piece that delivers "check the build passes first."
Tradeoff to weigh before enabling
/scripts. The vale job lints the content folders (docs/,introduction/,contributor/, …), and CodeQL is a security scan. The npm dependency updates Dependabot opens land in/scripts, which has no test or lint coverage, so "checks green" mainly means the docs linter passed and CodeQL found nothing - it does not prove the scripts still run. Scoping auto-merge to patch and minor only (as this workflow does) is the practical safeguard, since those are the updates least likely to break behavior. Adding even a minimal/scriptssmoke test later would strengthen the gate.Scope choice
Patch + minor auto-merge, major held for review. To auto-merge all updates including major, remove the
if:guard on the final step. To be stricter (patch only), narrow it toversion-update:semver-patch.One thing to confirm on the first run
Workflows triggered by Dependabot get a
GITHUB_TOKENwhose scope is controlled by thepermissions:block (set tocontents: write+pull-requests: writehere). If the first real run reports the token lacks permission to approve or merge, the alternatives are apull_request_targettrigger or a dedicated token; this follows GitHub's documented Dependabot pattern, so it should work as-is, but it is worth watching the first time it fires.🤖 Generated with Claude Code
https://claude.ai/code/session_01EqiXti3H1onRAb3esyV1Dg