Skip to content

ci: use GITHUB_TOKEN instead of CR_PAT for GHCR login#93

Merged
chorrell merged 1 commit into
mainfrom
ci/use-github-token-for-ghcr
May 26, 2026
Merged

ci: use GITHUB_TOKEN instead of CR_PAT for GHCR login#93
chorrell merged 1 commit into
mainfrom
ci/use-github-token-for-ghcr

Conversation

@chorrell
Copy link
Copy Markdown
Owner

The push job already has permissions: packages: write, so the built-in GITHUB_TOKEN is sufficient for authenticating with ghcr.io. This removes the need to create, rotate, or store a personal access token (CR_PAT) as a repo secret.

The CR_PAT secret can be deleted from the repository after this is merged.

@chorrell chorrell merged commit 0fe1b77 into main May 26, 2026
2 checks passed
@chorrell chorrell deleted the ci/use-github-token-for-ghcr branch May 26, 2026 03:58
@chorrell
Copy link
Copy Markdown
Owner Author

Build failure — one-time manual setup required

The push job failed with permission_denied: write_package on GHCR. The GITHUB_TOKEN already has packages: write scope, but GHCR package access is controlled separately from repository token permissions.

Because the ghcr.io/chorrell/json package was originally created via CR_PAT, it is not yet connected to this repository. The GITHUB_TOKEN can only push to packages that are explicitly linked to the repository that's running the workflow.

One-time fix (no code change needed):

  1. Go to https://github.com/users/chorrell/packages/container/json/settings
  2. Under "Manage Actions access", click "Add Repository"
  3. Select chorrell/docker-json and set the role to Write
  4. Re-run the failed job

After that, the GITHUB_TOKEN will work and the CR_PAT secret can be deleted from the repository.

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