Skip to content

[Fix] Add contents:write permission to ghcr_deploy release job#23917

Merged
yuneng-jiang merged 1 commit intomainfrom
litellm_/loving-noyce
Mar 18, 2026
Merged

[Fix] Add contents:write permission to ghcr_deploy release job#23917
yuneng-jiang merged 1 commit intomainfrom
litellm_/loving-noyce

Conversation

@yuneng-jiang
Copy link
Copy Markdown
Contributor

Summary

Failure Path (Before Fix)

The release job in ghcr_deploy.yml failed with Resource not accessible by integration when calling repos.createRelease. Other jobs in the workflow explicitly set permissions with contents: read, which caused GitHub to scope the default token down for all jobs — including the release job which had no permissions block.

Fix

Added contents: write to the release job's permissions so the GITHUB_TOKEN can create GitHub releases.

Testing

  • Verified the workflow YAML is valid
  • The fix aligns with GitHub's documentation on job-level permission scoping

Type

🐛 Bug Fix
🚄 Infrastructure

…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]>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Mar 18, 2026 0:25am

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 18, 2026

Greptile Summary

This PR fixes the release job in ghcr_deploy.yml which was failing with Resource not accessible by integration when trying to call repos.createRelease. The root cause is that the repository's default GITHUB_TOKEN permissions are read-only, and any job without an explicit permissions block inherits those restricted defaults. Adding contents: write to the release job is the correct, minimal fix.

Key changes:

  • Added permissions: contents: write to the release job so GITHUB_TOKEN is allowed to create GitHub releases.

Potential issue found:

  • The build-and-push-helm-chart job (which runs in parallel and is also gated on release_type != 'dev') uses secrets.GITHUB_TOKEN to push a Helm OCI chart to GHCR. This job has no explicit permissions block, meaning it may silently fail for the same reason — it likely needs packages: write added explicitly.

Confidence Score: 4/5

  • Safe to merge — the one-line permissions fix is correct and minimal, with one closely related job that may still be affected by the same root cause.
  • The core fix (contents: write on the release job) is accurate and well-scoped. The only concern is the build-and-push-helm-chart job, which appears to have the same missing-permissions pattern. That job should be addressed either in this PR or a follow-up.
  • .github/workflows/ghcr_deploy.yml — specifically the build-and-push-helm-chart job which may also need an explicit permissions block.

Important Files Changed

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"]
Loading

Comments Outside Diff (1)

  1. .github/workflows/ghcr_deploy.yml, line 311-316 (link)

    P1 build-and-push-helm-chart also lacks explicit permissions

    This job uses secrets.GITHUB_TOKEN to authenticate with GHCR (docker/login-action) and then pushes a Helm OCI chart via ./.github/actions/helm-oci-chart-releaser. Pushing packages to GHCR requires packages: write. Because other jobs in this workflow already set job-level permissions blocks 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 a Resource not accessible by integration error when it tries to push the chart.

    Consider adding an explicit permissions block:

Last reviewed commit: "[Fix] Add contents:w..."

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq bot commented Mar 18, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing litellm_/loving-noyce (b8ffbba) with main (ef9cc33)

Open in CodSpeed

@yuneng-jiang yuneng-jiang merged commit 195c0ee into main Mar 18, 2026
50 of 88 checks passed
@ishaan-berri ishaan-berri deleted the litellm_/loving-noyce branch March 26, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants