Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.

Commit 105d75e

Browse files
sapientpantsclaude
andauthored
fix: add packages:write permission to reusable-docker workflow (#320)
The v1.10.17 build failed when pushing multi-platform Docker images to GHCR with error: 'denied: installation not allowed to Create organization package' Root cause: reusable-docker.yml was missing packages:write permission needed to push to GHCR. While main.yml has this permission, reusable workflows require explicit permissions and do not inherit from callers. This fix adds packages:write to reusable-docker.yml permissions. The permission is only exercised when pushing to GHCR (multi-platform builds with save-artifact). PR builds remain unaffected (single-platform, no GHCR push). Fixes the failure in main workflow run #18434400565 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 65e35d1 commit 105d75e

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'sonarqube-mcp-server': patch
3+
---
4+
5+
Fix Docker image publishing by adding packages:write permission to workflows
6+
7+
The v1.10.17 build failed when attempting to push multi-platform Docker images to GitHub Container Registry (GHCR) with error: "denied: installation not allowed to Create organization package"
8+
9+
Root cause: The reusable-docker.yml workflow was missing the `packages: write` permission needed to push images to GHCR. While the main workflow had this permission, reusable workflows require explicit permissions and do not inherit from their callers.
10+
11+
Additionally, the PR workflow calls reusable-docker.yml, so it must also grant the permission even though PR builds don't use it (they use single-platform without push).
12+
13+
This fix adds `packages: write` to:
14+
15+
- `.github/workflows/reusable-docker.yml` - Required to push multi-platform images to GHCR
16+
- `.github/workflows/pr.yml` - Required to call reusable-docker.yml (permission not used in practice)
17+
18+
The permission is only exercised when the workflow actually pushes to GHCR (multi-platform builds with save-artifact=true). PR builds continue to use single-platform without pushing to GHCR.

.github/workflows/pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ concurrency:
2222
# contents: read - Read code for analysis
2323
# security-events: write - Upload security findings
2424
# actions: read - Access workflow artifacts
25+
# packages: write - Required by reusable-docker.yml (not used in PR builds)
2526
permissions:
2627
contents: read
2728
security-events: write
2829
actions: read
30+
packages: write
2931

3032
jobs:
3133
# =============================================================================

.github/workflows/reusable-docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ on:
5656
permissions:
5757
contents: read # Read source code
5858
security-events: write # Upload Trivy scan results
59+
packages: write # Push Docker images to GitHub Container Registry
5960

6061
jobs:
6162
docker:

0 commit comments

Comments
 (0)