Skip to content

Commit 971b76a

Browse files
authored
Merge pull request #59 from crazy-max/ghcr-github-token
Use GITHUB_TOKEN with GHCR
2 parents ab81ae0 + 5b092cf commit 971b76a

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

98.7 KB
Loading

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ jobs:
149149
uses: ./
150150
with:
151151
registry: ghcr.io
152-
username: ${{ secrets.GHCR_USERNAME }}
153-
password: ${{ secrets.GHCR_PAT }}
152+
username: ${{ github.repository_owner }}
153+
password: ${{ secrets.GITHUB_TOKEN }}
154154

155155
gitlab:
156156
runs-on: ubuntu-latest

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ jobs:
8989

9090
### GitHub Container Registry
9191

92-
To authenticate against the [GitHub Container Registry](https://docs.github.com/en/packages/getting-started-with-github-container-registry),
93-
you will need to [enable it for your user or organization account](https://docs.github.com/en/packages/guides/enabling-improved-container-support)
94-
and create a new [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
95-
with the [appropriate scopes](https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry).
92+
To use the [GitHub Container Registry](https://docs.github.com/en/packages/getting-started-with-github-container-registry),
93+
you need to [enable this feature for your personal or organization account](https://docs.github.com/en/packages/guides/enabling-improved-container-support).
94+
95+
To [authenticate against it](https://docs.github.com/en/packages/guides/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry),
96+
use the [`GITHUB_TOKEN`](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) for the best
97+
security and experience.
9698

9799
```yaml
98100
name: ci
@@ -111,9 +113,16 @@ jobs:
111113
with:
112114
registry: ghcr.io
113115
username: ${{ github.repository_owner }}
114-
password: ${{ secrets.CR_PAT }}
116+
password: ${{ secrets.GITHUB_TOKEN }}
115117
```
116118

119+
You may need to manage write and read access of GitHub Actions for repositories in the container settings:
120+
121+
![Manage Actions access](.github/ghcr-manage-actions-access.gif)
122+
123+
You can also use a [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
124+
with the [appropriate scopes](https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry).
125+
117126
### GitLab
118127

119128
```yaml

0 commit comments

Comments
 (0)