name: Auto request reviewer

on:
  pull_request_target:
    types: [opened, reopened, ready_for_review]

permissions:
  pull-requests: write

jobs:
  request:
    runs-on: ubuntu-latest
    steps:
      - name: Request review from @mntrushmore
        uses: actions/github-script@v7
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            const reviewers = ['mntrushmore']
            const {owner, repo} = context.repo
            const pull_number = context.payload.pull_request.number
            await github.request('POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers', {
              owner, repo, pull_number, reviewers
            })
