ci: enable Dependabot with auto-merge for patch & minor updates (#148)

Adds .github/dependabot.yml (weekly npm + github-actions; minor/patch
grouped) and a dependabot-auto-merge workflow that enables GitHub
auto-merge (gh pr merge --auto --squash) for patch & minor bumps, leaving
major versions for manual review. Uses fetch-metadata; PR URL passed via
a quoted env var (no injection); does not check out PR code.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Manav Arya Singh
2026-06-18 13:54:17 +04:00
committed by GitHub
parent 1ab1151105
commit 127815f0b5
2 changed files with 57 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
version: 2
updates:
# npm dependencies — group low-risk bumps so auto-merge handles them in one PR.
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- dependencies
groups:
minor-and-patch:
update-types:
- minor
- patch
# Keep GitHub Actions pinned and current.
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
labels:
- dependencies
- github-actions
@@ -0,0 +1,33 @@
name: Dependabot auto-merge
# Auto-merge Dependabot PRs for low-risk updates (patch + minor, and any
# security patch). Major version bumps are left for manual review.
#
# Requires "Allow auto-merge" enabled on the repo. `gh pr merge --auto` queues
# the merge so it only lands once required status checks pass.
on: pull_request_target
permissions:
contents: write
pull-requests: write
jobs:
auto-merge:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Fetch Dependabot metadata
id: meta
uses: dependabot/fetch-metadata@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge for patch & minor updates
if: >-
steps.meta.outputs.update-type == 'version-update:semver-patch' ||
steps.meta.outputs.update-type == 'version-update:semver-minor'
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}