name: auto-approve

on:
  pull_request:
    branches: [ master ]

jobs:
  auto-approve:
    runs-on: ubuntu-latest
    if: github.event_name == 'pull_request' && github.event.pull_request.user.login == github.repository_owner
    permissions:
      pull-requests: write
    steps:
    - uses: actions/checkout@v4
    - name: Auto-approve PR
      run: gh pr review ${{ github.event.pull_request.number }} --approve
      env:
        GITHUB_TOKEN: ${{ github.token }}
