| 1 | name: Documentation impact guard |
| 2 | |
| 3 | on: |
| 4 | pull_request_target: |
| 5 | branches: [main-v2] |
| 6 | types: [opened, synchronize, reopened, edited, ready_for_review] |
| 7 | |
| 8 | permissions: |
| 9 | contents: read |
| 10 | pull-requests: read |
| 11 | |
| 12 | concurrency: |
| 13 | group: docs-impact-${{ github.event.pull_request.number }} |
| 14 | cancel-in-progress: true |
| 15 | |
| 16 | jobs: |
| 17 | docs-impact: |
| 18 | runs-on: ubuntu-latest |
| 19 | steps: |
| 20 | # Execute only the trusted base-branch checker; never run contributor code |
| 21 | # from a pull_request_target workflow. |
| 22 | - uses: actions/checkout@v7 |
| 23 | with: |
| 24 | ref: ${{ github.event.pull_request.base.sha }} |
| 25 | |
| 26 | - name: Collect PR changed files |
| 27 | env: |
| 28 | GH_TOKEN: ${{ github.token }} |
| 29 | PR_NUMBER: ${{ github.event.pull_request.number }} |
| 30 | REPOSITORY: ${{ github.repository }} |
| 31 | run: | |
| 32 | gh api --paginate "repos/${REPOSITORY}/pulls/${PR_NUMBER}/files" \ |
| 33 | --jq '.[].filename' > "$RUNNER_TEMP/docs-impact-files.txt" |
| 34 | |
| 35 | - name: Check documentation impact declaration |
| 36 | env: |
| 37 | PR_BODY: ${{ github.event.pull_request.body }} |
| 38 | DOCS_IMPACT_CHANGED_FILES_FILE: ${{ runner.temp }}/docs-impact-files.txt |
| 39 | run: bash scripts/check-docs-impact.sh |
| 40 |