name: Auto-Merge
on:
  pull_request_target:
    types: [labeled]

jobs:
  enable-auto-merge:
    runs-on: ubuntu-latest

    if: contains(github.event.pull_request.labels.*.name, 'automerge')
    steps:
      - id: automerge
        name: automerge
        uses: "pascalgn/automerge-action@v0.15.3"
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          MERGE_METHOD: rebase
