fix(ci): restrict Dependabot auto-merge to security alerts#281
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Tightens the Dependabot auto-merge workflow so that it only enables auto-merge for PRs that are backed by an open Dependabot security alert, reducing the chance of routine version bumps being merged automatically.
Changes:
- Switch auto-merge gating from
update-type(semver patch/minor) to security alert metadata (ghsa-id+alert-state). - Configure
dependabot/fetch-metadata@v3to perform alert lookup using a dedicated secret token (DEPENDABOT_ALERTS_TOKEN). - Update workflow documentation to explain the security rationale and fail-closed intent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ddc78c5 to
df82506
Compare
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.
Motivation
update-typegate plus the defaultGITHUB_TOKENallowed non-security patch/minor bumps to be auto-merged, which broadened the attack surface.Description
dependabot/fetch-metadata@v3withalert-lookup: trueandgithub-token: ${{ secrets.DEPENDABOT_ALERTS_TOKEN }}to fetch Dependabot security metadata in/.github/workflows/dependabot-auto-merge.yml.steps.meta.outputs.ghsa-id != '' && steps.meta.outputs.alert-state == 'OPEN'and retain thegh pr merge --auto --squash "$PR_URL"call for eligible security PRs.Testing
ruby -e 'require "yaml"; data=YAML.load_file(".github/workflows/dependabot-auto-merge.yml"); puts data["name"]; puts data["jobs"]["auto-merge"]["steps"][0]["with"]["alert-lookup"]'which printed the expected values.git diff --checkwhich reported no whitespace or diff errors.actionlintwas not executed becauseactionlintis not installed in the environment.Codex Task