ci: declare contents:write on Release workflow's release job#2139
Merged
Conversation
The release job runs `gh release create` with the implicit GITHUB_TOKEN to attach helm chart tarballs and the aigw binaries as release assets. The releases/upload-asset API needs contents:write. The block sits on the `release` job rather than at workflow scope to avoid intersecting with the docker_push reusable workflow caller (`./.github/workflows/docker_build_job.yaml`), which has its own permissions story for the DockerHub push path. Style matches the per-job permissions blocks already used by codeql.yaml (actions:read, contents:read, security-events:write) and the workflow-level block in build_and_test.yaml (contents:read + packages:write + id-token:write). Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
nacx
reviewed
May 26, 2026
Signed-off-by: Ignasi Barrera <nacx@apache.org>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2139 +/- ##
==========================================
- Coverage 84.40% 84.33% -0.08%
==========================================
Files 134 134
Lines 19059 19352 +293
==========================================
+ Hits 16087 16320 +233
- Misses 1991 2033 +42
- Partials 981 999 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Description
The
Releaseworkflow runs on tag push and has two jobs:docker_push-- calls the reusable./.github/workflows/docker_build_job.yamlworkflowrelease-- runsgh release create(twice, branched on-rcsuffix) to attach helm tarballs + the aigw binaries to the GitHub releaseThe
gh release createAPI call needscontents: write. Right now there's nopermissions:block on either the workflow or thereleasejob, so the token gets whatever the repo default grants.This patch adds
permissions: contents: writeat thereleasejob (not at workflow scope) for two reasons:docker_pushis a reusable-workflow caller. Per GitHub docs on reusable workflows [1], a caller-levelpermissions:block intersects with the callee's grants. Keeping the new block on thereleasejob leaves the callee's existing permissions story unchanged.docker_pushcallee already authenticates to DockerHub viaDOCKERHUB_PASSWORDandDOCKERHUB_USERNAME(external secrets), so it doesn't need the workflowGITHUB_TOKENfor the push path.Style matches the per-job permission blocks already used by
codeql.yaml(actions: read, contents: read, security-events: write) and the workflow-level block inbuild_and_test.yaml(contents: read, packages: write, id-token: write).No behavioural change. The release workflow continues to use
${{ secrets.GITHUB_TOKEN }}for the twogh release createcalls, just with the scope spelled out.1: https://docs.github.com/en/actions/using-workflows/reusing-workflows#access-and-permissions