Skip to content

ci(workflows): fix permissions for GHCR push in update-current-image#299

Closed
chorrell wants to merge 1 commit into
mainfrom
ci/add-ghcr-write-permissions
Closed

ci(workflows): fix permissions for GHCR push in update-current-image#299
chorrell wants to merge 1 commit into
mainfrom
ci/add-ghcr-write-permissions

Conversation

@chorrell
Copy link
Copy Markdown
Owner

Problem

The update-current-image workflow was failing to push Docker images to GitHub Container Registry (GHCR) with:

denied: permission_denied: write_package

This occurred because the workflow lacked the required packages:write permission to authenticate with GITHUB_TOKEN for GHCR operations.

Solution

Added explicit job-level permissions following the principle of least privilege:

  • build job: contents:read + packages:write (for building and pushing per-platform images)
  • merge job: contents:read + packages:write (for creating multi-arch manifests)
  • check_version job: contents:read (for repository checkout only)

Removed packages:write from workflow-level permissions to comply with security audit (zizmor) recommendations.

Testing

  • All pre-commit hooks pass, including zizmor security audit
  • Workflow permissions are now minimal and correctly scoped

The update-current-image workflow was failing to push to GitHub Container
Registry (GHCR) with 'permission_denied: write_package' errors due to missing
packages:write permission. Added explicit job-level permissions following
least privilege principle:

- build job: contents:read + packages:write (for building and pushing images)
- merge job: contents:read + packages:write (for creating multi-arch manifests)
- check_version job: contents:read (for repository access only)
- Removed packages:write from workflow-level permissions (per zizmor audit)
@chorrell chorrell closed this May 31, 2026
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.

1 participant