-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (47 loc) · 1.36 KB
/
auto_merge.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: Auto approve and merge Dependabot PRs
on:
pull_request:
types:
- opened
- synchronize
branches:
- main
jobs:
auto-approve-and-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Approve PR
uses: actions/github-script@v3
with:
github-token: ${{ secrets.PAT }}
script: |
github.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
event: 'APPROVE'
});
- name: Add label
uses: actions/github-script@v3
with:
github-token: ${{ secrets.PAT }}
script: |
github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['approved']
});
- name: Merge PR
uses: actions/github-script@v3
with:
github-token: ${{ secrets.PAT }}
script: |
github.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});