ci(release): Stop requesting permissions from the reusable workflow - #3276
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
PR Summary by QodoMove toolchain permissions to weekly release callers
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. Weekly cache writes remain unauthorized
|
| permissions: | ||
| contents: read |
There was a problem hiding this comment.
1. Weekly cache writes remain unauthorized 🐞 Bug ≡ Correctness
build-generals and build-generalsmd set only contents: read, so the reusable workflow's token has no packages: write permission after its own permission block was removed. When either matrix uses a preset containing vcpkg, build-toolchain.yml configures a read-write GitHub Packages source and silently cannot upload the binary cache.
Agent Prompt
## Issue description
The weekly-release callers grant only `contents: read`, although the reusable build workflow requires `packages: write` when running a vcpkg preset. Without that grant, vcpkg silently skips binary-cache uploads.
## Fix Focus Areas
- .github/workflows/weekly-release.yml[90-91]
- .github/workflows/weekly-release.yml[111-112]
## Recommended Fix
Add `packages: write` to the `permissions` mapping for both `build-generals` and `build-generalsmd`, retaining `contents: read` for checkout access.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
the reusable build workflow requires
packages: writewhen running a vcpkg preset
And tell me my friend, where are the vcpkg presets in the weekly release?
|
| Filename | Overview |
|---|---|
| .github/workflows/build-toolchain.yml | Removes reusable-workflow permission declarations so caller jobs explicitly determine the token permissions available to builds. |
| .github/workflows/ci.yml | Narrows default permissions and grants package-write access only to the two vcpkg build jobs. |
| .github/workflows/weekly-release.yml | Gives non-vcpkg reusable build jobs read-only access and removes unnecessary secret inheritance. |
Reviews (2): Last reviewed commit: "ci(build-toolchain): stop requesting per..." | Re-trigger Greptile
bobtista
left a comment
There was a problem hiding this comment.
Change looks good to me. Two nits on the wording:
The title says it grants packages: write in the callers, but the diff grants none, it removes the request from build-toolchain and gives the weekly jobs contents: read. Something like "ci(build-toolchain): Stop requesting permissions from the reusable workflow" would work.
And the new comment says GHCR, but the cache is the GitHub Packages NuGet feed, and "callers must grant packages: write" only holds for vcpkg presets. Maybe: "No permissions on purpose. Callers grant them per job: contents read for every preset, plus packages write for vcpkg presets or the NuGet binary cache is skipped with only a warning."
|
Also, ci.yml's top-level pull-requests: write is now unused. Nothing in ci.yml uses it either. Could clean it up here or in a separate PR and move its packages: write onto the three vcpkg build jobs |
CryoTheRenegade
left a comment
There was a problem hiding this comment.
Looks good, but pr title may be misleading
b42a5b9 to
b9ece32
Compare
|
Pushed the fixes for the two nits, and cleaned up the unused |
|
Is there a way to run this the weekly release from this PR before merging? So we know it works? |
|
We cannot run it from this PR directly, but you can see this example on my fork: https://github.com/tintinhamans/GeneralsGameCode/actions/runs/34703775473 |
Weekly Release was failing at startup because
build-toolchain.ymlasked for
packages: writebut the callers never granted it(
secrets: inheritdoesn't extend permissions).Fixed by dropping the request from the reusable workflow and granting
contents: read(andpackages: writefor vcpkg presets) on thecaller jobs instead. Also dropped
ci.yml's top-levelpull-requests: write, unused there. Added a comment since a missinggrant fails silently - vcpkg just stops using the NuGet cache instead
of erroring.
Tested on my fork, workflow runs clean now.