| 1 | # Checks that a pull request is ready for review (CONTRIBUTING.md, "When a PR is ready for review"). |
| 2 | # pull_request_target so it also runs on forks of first-time contributors without approval. |
| 3 | # It checks out main only and reads the PR as data through the API: never check out or run PR code here. |
| 4 | name: PR gate |
| 5 | |
| 6 | on: |
| 7 | pull_request_target: |
| 8 | types: [opened, edited, synchronize, reopened, ready_for_review, labeled, unlabeled] |
| 9 | workflow_dispatch: |
| 10 | |
| 11 | permissions: |
| 12 | contents: read |
| 13 | issues: write |
| 14 | pull-requests: write |
| 15 | |
| 16 | concurrency: |
| 17 | group: pr-gate-${{ github.event.pull_request.number || 'all' }} |
| 18 | cancel-in-progress: true |
| 19 | |
| 20 | jobs: |
| 21 | gate: |
| 22 | name: Ready for review |
| 23 | runs-on: ubuntu-latest |
| 24 | timeout-minutes: 10 |
| 25 | steps: |
| 26 | - uses: actions/checkout@v6 |
| 27 | with: |
| 28 | ref: ${{ github.event.repository.default_branch }} |
| 29 | persist-credentials: false |
| 30 | sparse-checkout: .github/scripts |
| 31 | |
| 32 | - name: Check |
| 33 | env: |
| 34 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 35 | PR_NUMBER: ${{ github.event.pull_request.number }} |
| 36 | run: python3 -I .github/scripts/pr_gate.py |
| 37 | |