Skip to content

Commit 749c135

Browse files
Copilotleonpwd
andcommitted
Fix GHCR permission issues: add top-level permissions and use repository_owner
- Add top-level permissions block with contents: read and packages: write - Change GHCR login username from github.actor to github.repository_owner - Addresses permission_denied: write_package error from job ref fd0df22 Co-authored-by: leonpwd <60449031+leonpwd@users.noreply.github.com>
1 parent 3adfff4 commit 749c135

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/build-and-push.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: Build and Push Docker Image
22

3+
# Top-level permissions: explicitly request package write rights for GITHUB_TOKEN
4+
permissions:
5+
contents: read
6+
packages: write
7+
38
on:
49
push:
510
branches:
@@ -27,7 +32,7 @@ jobs:
2732
uses: docker/login-action@v3
2833
with:
2934
registry: ghcr.io
30-
username: ${{ github.actor }}
35+
username: ${{ github.repository_owner }}
3136
password: ${{ secrets.GITHUB_TOKEN }}
3237

3338
- name: Build and push Docker image

0 commit comments

Comments
 (0)