This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (52 loc) · 2.4 KB
/
dependabot_auto_merge.yml
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
name: Dependabot
on:
pull_request:
types:
- opened
- reopened
- synchronize
permissions:
contents: write
pull-requests: write
repository-projects: read
jobs:
dependabot:
name: Enable Auto-Merge and Approve
if: ${{ github.actor == 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'automerge') && !contains(github.head_ref, '/terraform/') }}
runs-on: ubuntu-latest
steps:
- name: Fetch Dependabot Metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: GitHub Actions - Patch or Minor
if: ${{ contains(github.head_ref, '/github_actions/') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') }}
shell: bash --noprofile --norc -xeo pipefail {0}
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr review "$PR_URL" --approve
gh pr merge "$PR_URL" --auto --squash
gh pr edit "$PR_URL" --add-label 'automerge'
- name: Development - Patch or Minor
if: ${{ !contains(github.head_ref, '/github_actions/') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') && steps.metadata.outputs.dependency-type == 'direct:development' }}
shell: bash --noprofile --norc -xeo pipefail {0}
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr review "$PR_URL" --approve
gh pr merge "$PR_URL" --auto --squash
gh pr edit "$PR_URL" --add-label 'automerge'
- name: Production - Patch
if: ${{ !contains(github.head_ref, '/github_actions/') && steps.metadata.outputs.update-type == 'version-update:semver-patch' && steps.metadata.outputs.dependency-type == 'direct:production' }}
shell: bash --noprofile --norc -xeo pipefail {0}
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr review "$PR_URL" --approve
gh pr merge "$PR_URL" --auto --squash
gh pr edit "$PR_URL" --add-label 'automerge'