[Fix] Add contents:write permission to ghcr_deploy release job#23917
[Fix] Add contents:write permission to ghcr_deploy release job#23917yuneng-jiang merged 1 commit intomainfrom
Conversation
…kflow The release job was failing with "Resource not accessible by integration" because other jobs explicitly set permissions, causing GitHub to scope the default token down for all jobs. The release job needs contents:write to create GitHub releases. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes the Key changes:
Potential issue found:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| .github/workflows/ghcr_deploy.yml | Adds contents: write permission to the release job so GITHUB_TOKEN can call repos.createRelease; the build-and-push-helm-chart job still lacks an explicit permissions block despite also using GITHUB_TOKEN against GHCR. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
dispatch([workflow_dispatch]) --> print[print]
dispatch --> docker-hub-deploy["docker-hub-deploy\n(no permissions block)"]
dispatch --> build-and-push-image["build-and-push-image\ncontents: read\npackages: write"]
dispatch --> build-and-push-image-database["build-and-push-image-database\ncontents: read\npackages: write"]
dispatch --> build-and-push-image-ee["build-and-push-image-ee\ncontents: read\npackages: write"]
dispatch --> build-and-push-image-non_root["build-and-push-image-non_root\ncontents: read\npackages: write"]
dispatch --> build-and-push-image-spend-logs["build-and-push-image-spend-logs\ncontents: read\npackages: write"]
docker-hub-deploy --> helm["build-and-push-helm-chart\n⚠️ no permissions block\n(needs packages: write)"]
build-and-push-image --> helm
build-and-push-image-database --> helm
docker-hub-deploy --> release["release\n✅ contents: write\n(this PR's fix)"]
build-and-push-image --> release
build-and-push-image-database --> release
docker-hub-deploy --> observatory["run-observatory-tests\n(rc/stable only)"]
release --> discord["Github Releases To Discord"]
Comments Outside Diff (1)
-
.github/workflows/ghcr_deploy.yml, line 311-316 (link)build-and-push-helm-chartalso lacks explicit permissionsThis job uses
secrets.GITHUB_TOKENto authenticate with GHCR (docker/login-action) and then pushes a Helm OCI chart via./.github/actions/helm-oci-chart-releaser. Pushing packages to GHCR requirespackages: write. Because other jobs in this workflow already set job-levelpermissionsblocks and the repo/org default token is presumably read-only (that is the root cause described in this PR), this job has the same exposure and may also fail with aResource not accessible by integrationerror when it tries to push the chart.Consider adding an explicit
permissionsblock:
Last reviewed commit: "[Fix] Add contents:w..."
Summary
Failure Path (Before Fix)
The
releasejob inghcr_deploy.ymlfailed withResource not accessible by integrationwhen callingrepos.createRelease. Other jobs in the workflow explicitly setpermissionswithcontents: read, which caused GitHub to scope the default token down for all jobs — including thereleasejob which had no permissions block.Fix
Added
contents: writeto thereleasejob's permissions so theGITHUB_TOKENcan create GitHub releases.Testing
Type
🐛 Bug Fix
🚄 Infrastructure