Skip to content

Commit d8c36c8

Browse files
web3-botStebalien
authored andcommitted
add .github/workflows/automerge.yml
1 parent c361b87 commit d8c36c8

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/automerge.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
# Automatically merge pull requests opened by web3-bot, as soon as (and only if) all tests pass.
5+
# This reduces the friction associated with updating with our workflows.
6+
7+
on: [ pull_request ]
8+
name: Automerge
9+
10+
jobs:
11+
automerge-check:
12+
if: github.event.pull_request.user.login == 'web3-bot'
13+
runs-on: ubuntu-latest
14+
outputs:
15+
status: ${{ steps.should-automerge.outputs.status }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Check if we should automerge
21+
id: should-automerge
22+
run: |
23+
for commit in $(git rev-list --first-parent origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}); do
24+
committer=$(git show --format=$'%ce' -s $commit)
25+
echo "Committer: $committer"
26+
if [[ "$committer" != "[email protected]" ]]; then
27+
echo "Commit $commit wasn't committed by web3-bot, but by $committer."
28+
echo "::set-output name=status::false"
29+
exit
30+
fi
31+
done
32+
echo "::set-output name=status::true"
33+
automerge:
34+
needs: automerge-check
35+
runs-on: ubuntu-latest
36+
if: ${{ needs.automerge-check.outputs.status == 'true' }}
37+
steps:
38+
- name: Wait on tests
39+
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2
40+
with:
41+
ref: ${{ github.event.pull_request.head.sha }}
42+
repo-token: ${{ secrets.GITHUB_TOKEN }}
43+
wait-interval: 10
44+
running-workflow-name: 'automerge' # the name of this job
45+
- name: Merge PR
46+
uses: pascalgn/automerge-action@741c311a47881be9625932b0a0de1b0937aab1ae # v0.13.1
47+
env:
48+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
49+
MERGE_LABELS: ""
50+
MERGE_METHOD: "squash"
51+
MERGE_DELETE_BRANCH: true

0 commit comments

Comments
 (0)