-
Notifications
You must be signed in to change notification settings - Fork 68
59 lines (52 loc) · 2.35 KB
/
dependabot-auto-merge.yml
File metadata and controls
59 lines (52 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Dependabot Auto-Merge
on: pull_request_target
permissions:
contents: write
pull-requests: write
jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Auto-approve and enable auto-merge for patch updates (all deps)
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Auto-approve and enable auto-merge for minor updates (dev deps only)
if: |
steps.metadata.outputs.dependency-type == 'direct:development' &&
steps.metadata.outputs.update-type == 'version-update:semver-minor'
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment on production minor/major updates requiring manual review
if: |
steps.metadata.outputs.dependency-type == 'direct:production' &&
(steps.metadata.outputs.update-type == 'version-update:semver-minor' ||
steps.metadata.outputs.update-type == 'version-update:semver-major')
run: |
gh pr comment "$PR_URL" --body "⚠️ This PR updates production dependencies and requires manual review before merging."
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment on dev major updates requiring manual review
if: |
steps.metadata.outputs.dependency-type == 'direct:development' &&
steps.metadata.outputs.update-type == 'version-update:semver-major'
run: |
gh pr comment "$PR_URL" --body "ℹ️ This PR updates development dependencies with major version changes. Please review for potential breaking changes in the build/test pipeline."
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}