name: Auto close
on:
  pull_request_target:
    types: [opened]

permissions:
  pull-requests: write

jobs:
  auto-close:
    runs-on: ubuntu-latest
    if: github.actor == 'dependabot[bot]'
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Install action dependencies
        run: cd .github/actions/close-bot && npm ci

      - uses: ./.github/actions/close-bot
        with:
          github-token: '${{ secrets.GITHUB_TOKEN }}'
