Skip to content

Commit 4e34d6a

Browse files
committed
Add merge github action
1 parent ae4b029 commit 4e34d6a

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

.github/workflows/go-auto-approve.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: auto approve and tidy
1+
name: auto approve and merge and tidy
22
on:
33
pull_request:
44
paths:
5-
- '.github/workflows/gosum.yml'
6-
- 'go.mod'
7-
- 'go.sum'
5+
- ".github/workflows/gosum.yml"
6+
- "go.mod"
7+
- "go.sum"
88

99
# job level conditions don't seem to work at the moment
1010
# https://github.community/t5/GitHub-Actions/Status-of-workflows-with-no-running-jobs/td-p/37160
@@ -25,7 +25,7 @@ jobs:
2525
- name: setup go
2626
uses: actions/setup-go@v1
2727
with:
28-
go-version: '1.14'
28+
go-version: "1.14"
2929
- name: Tidy
3030
run: |
3131
go version
@@ -56,4 +56,28 @@ jobs:
5656
uses: hmarr/[email protected]
5757
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
5858
with:
59-
github-token: "${{ secrets.GITHUB_TOKEN }}"
59+
github-token: "${{ secrets.GITHUB_TOKEN }}"
60+
merge:
61+
name: auto-merge dependabot PRs
62+
runs-on: ubuntu-latest
63+
needs: [approve]
64+
steps:
65+
- name: "Wait for status checks"
66+
id: waitforstatuschecks
67+
uses: "WyriHaximus/[email protected]"
68+
with:
69+
ignoreActions: merge
70+
checkInterval: 13
71+
env:
72+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
73+
- name: merge
74+
uses: actions/[email protected]
75+
if: (github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]') && steps.waitforstatuschecks.outputs.status == 'success'
76+
with:
77+
script: |
78+
github.pullRequests.merge({
79+
owner: context.payload.repository.owner.login,
80+
repo: context.payload.repository.name,
81+
pull_number: context.payload.pull_request.number
82+
})
83+
github-token: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)