-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (29 loc) · 1.2 KB
/
Copy pathdependabot-auto-merge.yml
File metadata and controls
35 lines (29 loc) · 1.2 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
name: Dependabot auto-merge (GitHub native)
on:
pull_request_target:
types: [opened, reopened, synchronize, ready_for_review]
permissions:
pull-requests: write
contents: write
jobs:
enable-automerge:
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Fetch Dependabot metadata
id: meta
uses: dependabot/fetch-metadata@v2
with:
github-token: ${{ secrets.AUTO_MERGE_DEPENDABOT }}
- name: Approve PR (only if required by branch rules)
if: ${{ steps.meta.outputs.update-type != 'version-update:semver-major' }}
run: gh pr review "$PR_NUMBER" --approve --repo "$GITHUB_REPOSITORY"
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GH_TOKEN: ${{ secrets.AUTO_MERGE_DEPENDABOT }}
- name: Enable auto-merge (squash)
if: ${{ steps.meta.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge "$PR_NUMBER" --squash --auto --repo "$GITHUB_REPOSITORY"
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GH_TOKEN: ${{ secrets.AUTO_MERGE_DEPENDABOT }}