name: automerge

on:
  push:
    branches-ignore: '*' # ignore everything
#  pull_request:
#    types:
#      - labeled
#      - unlabeled
#      - synchronize
#      - opened
#      - edited
#      - ready_for_review
#      - reopened
#      - unlocked
#  pull_request_review:
#    types:
#      - submitted
#  status: {}

jobs:
  automerge:
    runs-on: ubuntu-latest
    steps:
      - name: 'Wait for status checks'
        id: waitforstatuschecks
        uses: "WyriHaximus/github-action-wait-for-status@f8bbe3bb321919ec6a009bc98121f39874dc8ee0"
        with:
          ignoreActions: automerge
          checkInterval: 30
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
      - name: 'Merge'
        uses: pascalgn/automerge-action@v0.6.1
        if: steps.waitforstatuschecks.outputs.status == 'success'
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          MERGE_LABELS: "automerge,!wip"
          MERGE_METHOD: "squash"
          MERGE_COMMIT_MESSAGE: "pull-request-description"
          MERGE_FORKS: "false"
          MERGE_RETRIES: "6"
          MERGE_RETRY_SLEEP: "10000"
          UPDATE_LABELS: ""
          UPDATE_METHOD: "rebase"
