Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Dependabot auto-merge

on:
pull_request_target:
branches: [master]

permissions:
contents: write
pull-requests: write

jobs:
auto-merge:
name: Auto-merge low-risk Dependabot PRs
if: github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

# Arming auto-merge is the whole job, and the merge still waits for CI:
# `--auto` queues it behind the required checks rather than merging now.
# There is no approve step on purpose. GITHUB_TOKEN cannot approve a pull
# request ("Allow GitHub Actions to create and approve pull requests" is
# off org-wide), so an approve step would fail on every single bump, and a
# check that is always red teaches you to stop reading red checks.
#
# Scope is deliberately narrow: workflow action bumps only, minor and
# patch. A pub dependency reaches the package's own resolution graph and a
# major bump is a breaking change by declaration, so both keep a human.
- name: Arm auto-merge for GH Actions minor + patch
if: |
steps.metadata.outputs.package-ecosystem == 'github_actions' &&
(steps.metadata.outputs.update-type == 'version-update:semver-minor' ||
steps.metadata.outputs.update-type == 'version-update:semver-patch')
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr merge --auto --squash "$PR_URL"