name: Automerge release bump PR

on: pull_request_target
  
jobs:
  autoapprove:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    if: ${{github.actor == 'flowbuild-bot'}} || ${{github.actor == 'bot-flowbuild'}}
    steps:
      - name: Autoapproving
        uses: hmarr/auto-approve-action@v3
        with:
          review-message: "Auto approved automated PR"

  automerge:
    needs: [autoapprove]
    runs-on: ubuntu-latest
    steps:
      - name: Automerging
        uses: pascalgn/automerge-action@v0.15.6
        if: ${{github.actor == 'flowbuild-bot'}} || ${{github.actor == 'bot-flowbuild'}}
        env:
          GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
          GITHUB_LOGIN: flowbuild-bot
          MERGE_LABELS: ""
          MERGE_METHOD: "squash"
          MERGE_COMMIT_MESSAGE: "pull-request-title"
          MERGE_RETRIES: "5"
          MERGE_RETRY_SLEEP: "60000"
          MERGE_FILTER_AUTHOR: 'bot-flowbuilld'
          MERGE_DELETE_BRANCH: true