Skip to content

Commit f32ec8d

Browse files
lainraclaude
andcommitted
feat: add Dependabot auto-merge and PR labeling
- Add workflow to auto-merge Dependabot PRs for patch and minor updates - Major updates require manual review - Group minor and patch updates together in dependabot.yml - Add PR labeler workflow and configuration - Add auto-merge configuration file - Ensures all tests pass before merging This will help maintain dependencies automatically while keeping the codebase secure and up-to-date. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 66d63fd commit f32ec8d

5 files changed

Lines changed: 169 additions & 0 deletions

File tree

.github/auto-merge.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Configuration for probot-auto-merge or GitHub's auto-merge feature
2+
3+
# Merge method to use
4+
mergeMethod: squash
5+
6+
# Automatically delete the branch after merge
7+
deleteBranchAfterMerge: true
8+
9+
# Required status checks
10+
requiredChecks:
11+
- "test (16.x)"
12+
- "test (18.x)"
13+
- "test (20.x)"
14+
- "docker-build"
15+
- "security"
16+
17+
# Blocking labels (PRs with these labels won't be auto-merged)
18+
blockingLabels:
19+
- "do-not-merge"
20+
- "work-in-progress"
21+
- "breaking-change"
22+
- "major-update"
23+
24+
# Rules for different types of PRs
25+
rules:
26+
# Auto-merge Dependabot minor and patch updates
27+
- match:
28+
authors: ["dependabot[bot]"]
29+
updateTypes: ["patch", "minor"]
30+
actions:
31+
merge:
32+
method: squash
33+
34+
# Auto-merge documentation updates
35+
- match:
36+
files: ["*.md", "docs/**"]
37+
authors: ["lainra"]
38+
actions:
39+
merge:
40+
method: squash

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ updates:
1616
commit-message:
1717
prefix: "chore"
1818
include: "scope"
19+
# Group all non-major updates together
20+
groups:
21+
npm-minor-patch:
22+
patterns:
23+
- "*"
24+
update-types:
25+
- "minor"
26+
- "patch"
1927

2028
# Enable version updates for Docker
2129
- package-ecosystem: "docker"

.github/labeler.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Configuration for actions/labeler
2+
3+
documentation:
4+
- changed-files:
5+
- any-glob-to-any-file:
6+
- '**/*.md'
7+
- 'docs/**'
8+
- '.github/*.md'
9+
10+
dependencies:
11+
- changed-files:
12+
- any-glob-to-any-file:
13+
- 'package.json'
14+
- 'package-lock.json'
15+
- 'yarn.lock'
16+
17+
docker:
18+
- changed-files:
19+
- any-glob-to-any-file:
20+
- 'Dockerfile*'
21+
- 'docker-compose*.yml'
22+
- '.dockerignore'
23+
24+
github-actions:
25+
- changed-files:
26+
- any-glob-to-any-file:
27+
- '.github/workflows/*'
28+
- '.github/actions/*'
29+
30+
tests:
31+
- changed-files:
32+
- any-glob-to-any-file:
33+
- '**/*.test.js'
34+
- 'test/**'
35+
- 'jest.config.js'
36+
37+
source:
38+
- changed-files:
39+
- any-glob-to-any-file:
40+
- 'src/**'
41+
- '!src/**/*.test.js'
42+
43+
configuration:
44+
- changed-files:
45+
- any-glob-to-any-file:
46+
- '.*rc'
47+
- '.*rc.js'
48+
- '.*rc.json'
49+
- '.env*'
50+
- 'config/**'
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Dependabot Auto-Merge
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
dependabot:
13+
runs-on: ubuntu-latest
14+
if: github.actor == 'dependabot[bot]'
15+
16+
steps:
17+
- name: Dependabot metadata
18+
id: metadata
19+
uses: dependabot/fetch-metadata@v2
20+
with:
21+
github-token: "${{ secrets.GITHUB_TOKEN }}"
22+
23+
- name: Auto-approve PR
24+
run: gh pr review --approve "$PR_URL"
25+
env:
26+
PR_URL: ${{ github.event.pull_request.html_url }}
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Enable auto-merge for Dependabot PRs
30+
if: |
31+
steps.metadata.outputs.update-type == 'version-update:semver-patch' ||
32+
steps.metadata.outputs.update-type == 'version-update:semver-minor'
33+
run: gh pr merge --auto --merge "$PR_URL"
34+
env:
35+
PR_URL: ${{ github.event.pull_request.html_url }}
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Add comment for major updates
39+
if: steps.metadata.outputs.update-type == 'version-update:semver-major'
40+
run: |
41+
gh pr comment "$PR_URL" --body "⚠️ **Major version update detected!**
42+
43+
This PR contains a major version update which may include breaking changes.
44+
Please review carefully before merging.
45+
46+
Update type: ${{ steps.metadata.outputs.update-type }}
47+
48+
To merge this PR after review, comment:
49+
\`@dependabot merge\`"
50+
env:
51+
PR_URL: ${{ github.event.pull_request.html_url }}
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/label.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Label PRs
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
label:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/labeler@v5
17+
with:
18+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
19+
sync-labels: true

0 commit comments

Comments
 (0)