-
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (43 loc) · 1.47 KB
/
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
on: pull_request_target
name: pull_request_target
permissions:
pull-requests: write
contents: write
jobs:
metadata:
runs-on: ubuntu-latest
outputs:
repository: ${{ steps.metadata.outputs.repository }}
steps:
- uses: actions/[email protected]
- uses: ahmadnassri/action-metadata@v2
id: metadata
auto-merge:
timeout-minutes: 5
runs-on: ubuntu-latest
# only run for dependabot PRs
if: ${{ github.actor == 'dependabot[bot]' }}
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- id: dependabot
uses: dependabot/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: auto merge conditions
id: auto-merge
if: |
(
steps.dependabot.outputs.update-type == 'version-update:semver-patch' &&
contains('direct:production,indirect:production', steps.dependabot.outputs.dependency-type)
) || (
steps.dependabot.outputs.update-type == 'version-update:semver-minor' &&
contains('direct:development,indirect:development', steps.dependabot.outputs.dependency-type)
)
run: echo "::notice ::auto-merge conditions satisfied"
- name: auto approve pr
if: ${{ steps.auto-merge.conclusion == 'success' }}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --rebase "$PR_URL"