Repository navigation
ci: drop pull-requests: read from the desktop matrix - #21927
Conversation
The desktop-matrix job already decides its matrix from a local git diff (dorny/paths-filter with an empty token), so it no longer reads the pull-request files API. Drop the now-unused pull-requests: read permission, pin the contents: read floor with a contract test, and note it in the CI docs. Ported from #13024 (commit f198ced); the rest of that change (local-diff mode, PR-only base fetch) is already on main.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] d9faf04 Description read[DESCRIPTION-READ] ea783e68e2c7ac7854b29e5d4185990a78a19806a3c8f3ac57f338e0f642d21b That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (3 items) — 3 justifiedIntent: give the desktop-matrix CI job only the token permission it actually uses. This is a FIX (least privilege).
[FIRST-PRINCIPLES-REVIEWED] d9faf04 Description read[DESCRIPTION-READ] 1e75b09d65351af084b872a1edd311340983b808d24375546c9c0a15b794ea1d That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
bolichen97
left a comment
There was a problem hiding this comment.
Looks good to me. Head reviewed: d9faf04.
What I checked:
- Every step of
desktop-matrixat this head: the runner pick,actions/checkoutwithpersist-credentials: false, the depth-1 base fetch,dorny/paths-filterwithtoken: '', andcompute. None of them calls the pull request REST API, socontents: readis enough. - Push and merge_group runs skip the filter and the base fetch, so they never needed the removed scope.
- No other test or doc on main pins
pull-requests: readfor this job. - The new contract test asserts the exact permissions map, so a re-added scope turns it red.
Bots on this head: Design PASS, First Principles PASS, Opus and GPT no blocking findings, UX skipped (no website change).
Remaining before merge: PR Readiness is still checking on this head (Coverage Combine was running). After this merges, #13024 can be closed as replaced.
bolichen97
left a comment
There was a problem hiding this comment.
Readiness passed on this head and no findings. Approving.
Problem / Motivation
Goal: The
desktop-matrixjob in.github/workflows/build.ymlholds only the permission it uses.The job already picks the PR desktop matrix from a local git diff:
dorny/paths-filterruns withtoken: ''after a depth-1 fetch of the PR base commit. It never calls the pull-request files API, yet it still requestspull-requests: read.Why it matters
An unused
pull-requests: readgrant widens the job token's scope for no gain. Least privilege says the job should holdcontents: readonly.Not a goal
What changed (motivation → approach → change)
Main already switched this job to local-diff mode (empty dorny token plus a depth-1 base fetch), so the PR-files API read and the permission it needed are gone in practice. The grant itself was left behind. This PR:
.github/workflows/build.yml: dropspull-requests: readfromdesktop-matrix; the job keepscontents: read.test/test_publish_feed_contract.py: a contract test pins the job's permissions to{"contents": "read"}.docs/ci/ci-and-reviews.md: one sentence notes where the PR decision comes from and the permission floor.#13024 (by @NB3025) also switched the job to local diff with a
fetch-depth: 0PR-only checkout and a timeout. That part is already on main in a different shape. The one piece main still lacks is dropping the unused permission. The commit keeps NB3025 as author.Backwards compatibility
Compatible: same filters, same matrix outputs; only the job token's scope gets smaller.
Reader: .github/workflows/build.yml:desktop-matrix dorny/paths-filter step -- release -- runs with
token: ''(local git diff), so it needs no pull-requests scope;test_desktop_matrix_does_not_request_pull_request_api_permissionReader: .github/workflows/build.yml:desktop-matrix compute/runner/checkout/base-fetch steps -- release -- read only the checked-out repo and event payload, covered by
contents: readTests
test_desktop_matrix_does_not_request_pull_request_api_permissionpins the job's permissions tocontents: read.build.yml: 562 passed.git diff --checkclean.Manual verification
N/A — the change is a permission removal pinned by a YAML contract test; this PR's own
Resolve desktop matrixrun exercises it.Related Issues
Replaces #13024. Related to #12920.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.