From a06433f518ac9c78dcb76936c8ede428677a1cc1 Mon Sep 17 00:00:00 2001 From: web3-bot Date: Tue, 1 Jun 2021 16:53:45 +0000 Subject: [PATCH] update .github/workflows/automerge.yml --- .github/workflows/automerge.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 840618d..32bcc2e 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -5,11 +5,35 @@ # This reduces the friction associated with updating with our workflows. on: [ pull_request ] +name: Automerge jobs: - automerge: + automerge-check: if: github.event.pull_request.user.login == 'web3-bot' runs-on: ubuntu-latest + outputs: + status: ${{ steps.should-automerge.outputs.status }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Check if we should automerge + id: should-automerge + run: | + for commit in $(git rev-list --first-parent origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}); do + committer=$(git show --format=$'%ce' -s $commit) + echo "Committer: $committer" + if [[ "$committer" != "web3-bot@users.noreply.github.com" ]]; then + echo "Commit $commit wasn't committed by web3-bot, but by $committer." + echo "::set-output name=status::false" + exit + fi + done + echo "::set-output name=status::true" + automerge: + needs: automerge-check + runs-on: ubuntu-latest + if: ${{ needs.automerge-check.outputs.status == 'true' }} steps: - name: Wait on tests uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2 -- GitLab