ci: declare contents:read on Lint workflow#2989
Open
arpitjain099 wants to merge 1 commit into
Open
Conversation
The Lint workflow runs cpplint and pylint against the checked-out tree. No cache, no GitHub API write. `permissions: contents: read` captures that and matches the per-job permissions blocks already used in deploy_nightly_docs.yml (pages:write + id-token:write) and upload-ci-logs.yml (statuses:write). build.yml is left out because it pulls mozilla-actions/sccache-action (which writes to the Actions cache) and easimon/maximize-build-space. A drive-by permissions block there would need actions:write for the sccache save path, which deserves a separate look. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Contributor
Greptile SummaryAdds a workflow-level
Confidence Score: 5/5Safe to merge — the change only restricts the GITHUB_TOKEN scope and has no effect on workflow behaviour. The change is two lines of YAML that add No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant GH as GitHub Actions
participant Token as GITHUB_TOKEN
participant Checkout as actions/checkout
participant Lint as Lint Script (local)
GH->>Token: "Issue token with permissions: contents=read"
GH->>Checkout: Run checkout step
Checkout->>Token: Request repo contents (read)
Token-->>Checkout: Granted (contents: read ✓)
Checkout-->>GH: Repo cloned
GH->>Lint: Run cpplint / pylint locally
Lint-->>GH: Lint results (no GitHub API calls)
Reviews (1): Last reviewed commit: "ci: declare contents:read on Lint workfl..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Lint workflow currently doesn't declare a
permissions:block, so itsGITHUB_TOKENinherits the repository default. Both jobs (pytorch_cpplint,pytorch_pylint) only check out the repo and run shell scripts that invoke cpplint and pylint locally. No cache, no GitHub API call, no comment-on-PR step.This patch sets
permissions: contents: readat workflow scope, matching the per-job permissions blocks already declared bydeploy_nightly_docs.yml(pages: write, id-token: write) andupload-ci-logs.yml(statuses: write).Out of scope for this PR (left for a separate change):
build.ymlusesmozilla-actions/sccache-action, which writes to the GitHub Actions cache. Declaring explicit permissions there has to account for theactions: writeneed on the cache save path; that's a more involved discussion than a drive-by warrants.attach-wheels-to-release.yml,blossom-ci.yml,trigger-ci.yml-- each is a multi-stage workflow (release publishing, hybrid-CI authorization). Their per-job permission story deserves a careful review on its own.license.ymlis small enough (~20 lines) that the noise/value ratio isn't worth a separate PR.No behavioural change to the Lint workflow.