-
Notifications
You must be signed in to change notification settings - Fork 16
52 lines (46 loc) · 1.82 KB
/
dependabot-automerge.yaml
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
name: Approve and enable auto-merge for Dependabot PRs
on:
workflow_call:
pull_request:
paths:
- '.github/workflows/dependabot-automerge.yaml'
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
# Direct dev dependencies
- name: Approve PR and auto-merge all dev-dependencies
if: ${{contains(steps.metadata.outputs.dependency-type, 'direct:development')}}
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --squash "$PR_URL"
# Direct prod dependencies
- name: Approve PR and auto-merge prod-dependencies (only patches)
if: ${{contains(steps.metadata.outputs.dependency-type, 'direct:production') && steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --squash "$PR_URL"
# Indirect dependencies
- name: Approve PR and auto-merge all indirect dependencies
if: ${{contains(steps.metadata.outputs.dependency-type, 'indirect') && steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --squash "$PR_URL"