-
Notifications
You must be signed in to change notification settings - Fork 16
ci: support multi-platform Docker image build (amd64 + arm64) #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
For docker/login-action@v3 with ghcr.io, does username need to match the owner of a PAT used as password, and is github.actor safe when the PAT belongs to a bot/service account?💡 Result:
Yes—when authenticating to GHCR (
ghcr.io) with a PAT, theusernameis expected to be the GitHub username of the account that owns the token (i.e., the user/bot that created the PAT). GitHub’s docker/OCI registry login examples explicitly treatUSERNAMEas “your GitHub username.” [1][2]github.actoris only correct when the credential is also for the actor (most commonly when usingsecrets.GITHUB_TOKEN, which is tied to the workflow run’s context and the action examples usegithub.actor). [3] If yourpasswordis a PAT that belongs to a bot/service account, then usingusername: ${{ github.actor }}is not safe/reliable (it may be a human user, dependabot, etc.)—setusernameto the bot/service account’s login instead. [1][2][3]Sources
[1] GitHub Docs – Working with the Container registry (GHCR) (docker login example) (docs.github.com)
[2] GitHub Docs – Working with the Docker registry (Enterprise Server) (explicitly “replace USERNAME with your GitHub username”) (docs.github.com)
[3] docker/login-action README (GHCR example uses
username: ${{ github.actor }}withGITHUB_TOKEN) (github.com)Citations:
GHCR authentication will fail if
PACKAGE_TOKENis a bot/service account PAT and tag is pushed by a different user.When authenticating to GHCR with a PAT, the
usernamemust match the account that owns the token. Using${{ github.actor }}(line 28) works only if the PAT owner and tag pusher are the same. Ifsecrets.PACKAGE_TOKENis a bot account's PAT, any tag pushed by a human user will fail login.Recommended fix: Either switch to
secrets.GITHUB_TOKENwith explicit package permissions, or store the bot account username in a separate secret.Option 1: Use GITHUB_TOKEN (recommended)
jobs: push: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Log into registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.PACKAGE_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }}Option 2: Keep PAT but use correct username
- name: Log into registry uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ secrets.PACKAGE_USERNAME }} password: ${{ secrets.PACKAGE_TOKEN }}Add
PACKAGE_USERNAMEsecret with the bot account's username.📝 Committable suggestion
🤖 Prompt for AI Agents