Skip to content

Commit c099ad8

Browse files
authored
fix: auto-approval and refine dependabot policy (#412)
## What changed This updates our Dependabot policy to reduce routine dependency-update noise while keeping minor and patch updates moving automatically. - Configure Dependabot to run weekly on Tuesday at 09:00 Europe/Paris for both `github-actions` and `bun` - Group all minor and patch updates per ecosystem: - one GitHub Actions update PR - one Bun dependency update PR - Keep major updates ungrouped so Dependabot opens individual PRs for manual review - Reduce routine open Dependabot PRs to one per ecosystem - Add cooldown windows so Dependabot avoids immediately chasing fresh releases: - 7 days for minor updates - 2 days for patch updates - Update the Dependabot automerge workflow to generate a GitHub App token before approving PRs - Auto-approve and enable automerge only for patch and minor updates, including `0.x` minors - Leave major update PRs for human review and merge ## Why Dependabot was not able to approve/automerge PRs using the default token. This follows the GitHub App token pattern recommended by security, while also tuning Dependabot for a better signal-to-noise ratio. The resulting behavior is: - minor/patch updates are batched weekly and can merge after CI passes - major updates still appear, but individually and without automerge - security updates remain handled by Dependabot/GitHub outside the routine grouping policy
1 parent afb0a59 commit c099ad8

2 files changed

Lines changed: 31 additions & 13 deletions

File tree

.github/dependabot.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ updates:
44
directory: /
55
schedule:
66
interval: weekly
7-
open-pull-requests-limit: 2
7+
day: tuesday
8+
time: "09:00"
9+
timezone: Europe/Paris
10+
open-pull-requests-limit: 1
11+
cooldown:
12+
semver-minor-days: 7
13+
semver-patch-days: 2
814
groups:
9-
actions-minor:
15+
actions-minor-patch:
16+
patterns:
17+
- "*"
1018
update-types:
1119
- minor
1220
- patch
@@ -15,15 +23,17 @@ updates:
1523
directory: /
1624
schedule:
1725
interval: weekly
18-
open-pull-requests-limit: 2
26+
day: tuesday
27+
time: "09:00"
28+
timezone: Europe/Paris
29+
open-pull-requests-limit: 1
30+
cooldown:
31+
semver-minor-days: 7
32+
semver-patch-days: 2
1933
groups:
20-
bun-development:
21-
dependency-type: development
22-
update-types:
23-
- minor
24-
- patch
25-
bun-production:
26-
dependency-type: production
34+
bun-minor-patch:
35+
patterns:
36+
- "*"
2737
update-types:
2838
- minor
2939
- patch

.github/workflows/dependabot.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,23 @@ jobs:
2424
with:
2525
github-token: "${{ secrets.GITHUB_TOKEN }}"
2626

27+
- name: Generate token
28+
id: app-token
29+
if: ${{ steps.meta.outputs.update-type == null || steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor' }}
30+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
31+
with:
32+
app-id: ${{ secrets.APP_ID }}
33+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
34+
2735
- name: Approve a PR
28-
if: ${{ steps.meta.outputs.update-type != 'version-update:semver-major' }}
36+
if: ${{ steps.meta.outputs.update-type == null || steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor' }}
2937
run: gh pr review --approve "$PR_URL"
3038
env:
3139
PR_URL: ${{ github.event.pull_request.html_url }}
32-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
3341

3442
- name: Enable auto-merge for Dependabot PRs
35-
if: ${{ steps.meta.outputs.update-type != 'version-update:semver-major' }}
43+
if: ${{ steps.meta.outputs.update-type == null || steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor' }}
3644
run: gh pr merge --auto --squash "$PR_URL"
3745
env:
3846
PR_URL: ${{ github.event.pull_request.html_url }}

0 commit comments

Comments
 (0)