| 1 | name: Cache impact guard |
| 2 | |
| 3 | on: |
| 4 | pull_request_target: |
| 5 | branches: [main-v2] |
| 6 | types: [opened, synchronize, reopened, edited, ready_for_review] |
| 7 | # The guard only cares about the prompt/tool surfaces listed in |
| 8 | # scripts/check-cache-impact.sh; PRs confined to clearly unrelated paths |
| 9 | # can never trip it, so skip the run entirely. Keep the ignore list |
| 10 | # conservative: when in doubt, run. |
| 11 | paths-ignore: |
| 12 | - 'docs/**' |
| 13 | - 'site/**' |
| 14 | - 'release-notes/**' |
| 15 | - 'workers/**' |
| 16 | - 'benchmarks/**' |
| 17 | - 'npm/**' |
| 18 | - '*.md' |
| 19 | |
| 20 | permissions: |
| 21 | contents: read |
| 22 | pull-requests: read |
| 23 | |
| 24 | concurrency: |
| 25 | group: cache-impact-${{ github.event.pull_request.number }} |
| 26 | cancel-in-progress: true |
| 27 | |
| 28 | jobs: |
| 29 | cache-impact: |
| 30 | runs-on: ubuntu-latest |
| 31 | steps: |
| 32 | - uses: actions/checkout@v7 |
| 33 | with: |
| 34 | ref: ${{ github.event.pull_request.base.sha }} |
| 35 | |
| 36 | - name: Collect PR changed files |
| 37 | env: |
| 38 | GH_TOKEN: ${{ github.token }} |
| 39 | PR_NUMBER: ${{ github.event.pull_request.number }} |
| 40 | REPOSITORY: ${{ github.repository }} |
| 41 | run: | |
| 42 | gh api --paginate "repos/${REPOSITORY}/pulls/${PR_NUMBER}/files" \ |
| 43 | --jq '.[].filename' > "$RUNNER_TEMP/cache-impact-files.txt" |
| 44 | |
| 45 | - name: Check cache-sensitive PR metadata |
| 46 | env: |
| 47 | PR_BODY: ${{ github.event.pull_request.body }} |
| 48 | CACHE_IMPACT_CHANGED_FILES_FILE: ${{ runner.temp }}/cache-impact-files.txt |
| 49 | run: bash scripts/check-cache-impact.sh |
| 50 |