name: Dependabot Pull Request Auto Merge

on: pull_request_target

jobs:
  automerge:
    name: Automerge Dependabot PRs
    runs-on: ubuntu-latest
    if: ${{ github.actor == 'dependabot[bot]' }}
    steps:
      - name: Dependabot metadata
        id: dependabot-metadata
        uses: dependabot/fetch-metadata@v1.1.1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
      # Allow auto-merging for patch and minor updates if all checks pass
      - name: Enable auto-merge for Dependabot PRs
        if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
        run: gh pr merge --auto --squash "$PR_URL"
        env:
          PR_URL: ${{ github.event.pull_request.html_url }}
          GITHUB_TOKEN: ${{ secrets.PROTECTED_BRANCH_PUSH }}

name: Dependabot Pull Request Auto Merge

on: pull_request_target

jobs:
  automerge:
    name: Automerge Dependabot PRs
    runs-on: ubuntu-latest
    if: ${{ github.actor == 'dependabot[bot]' }}
    steps:
      - name: Dependabot metadata
        id: dependabot-metadata
        uses: dependabot/fetch-metadata@v1.1.1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
      # Allow auto-merging for patch and minor updates if all checks pass
      - name: Enable auto-merge for Dependabot PRs
        if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
        run: gh pr merge --auto --squash "$PR_URL"
        env:
          PR_URL: ${{ github.event.pull_request.html_url }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Revert "[CI] Use protected branch push token [nodeploy]"
Revert "[CI] Use protected branch push token [nodeploy]"

This reverts commit 01cc9d73a0a1e0c5751097d0ca2f149db6d360f6.
