From 2452b40e9afa669fa522b1b4e4f9ebc70280cc55 Mon Sep 17 00:00:00 2001 From: Dan Bamikiya Date: Fri, 26 Nov 2021 13:38:53 +0100 Subject: [PATCH] Remove usage of outdated `GHCR_TOKEN` (#13710) * Remove usage of outdated GHCR_TOKEN * Prefer {{ github.actor }} over {{ github.repository_owner }} * Update language/java/configure-ci-cd.md with note about GITHUB_TOKEN Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com> * Update language/nodejs/configure-ci-cd.md with note about GITHUB_TOKEN Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com> * Update language/python/configure-ci-cd.md with note about GITHUB_TOKEN Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com> Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com> --- language/java/configure-ci-cd.md | 9 +++++++-- language/nodejs/configure-ci-cd.md | 9 +++++++-- language/python/configure-ci-cd.md | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/language/java/configure-ci-cd.md b/language/java/configure-ci-cd.md index 46874eabfc..2871db67e6 100644 --- a/language/java/configure-ci-cd.md +++ b/language/java/configure-ci-cd.md @@ -211,11 +211,16 @@ Next, change your Docker Hub login to a GitHub container registry login: uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_TOKEN }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} ``` {% endraw %} +To authenticate against the [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry), use the [`GITHUB_TOKEN`](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) for the best security and experience. + +You may need to [manage write and read access of GitHub Actions](https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio) for repositories in the container settings. + +You can also use a [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) 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). Remember to change how the image is tagged. The following example keeps ‘latest’ as the only tag. However, you can add any logic to this if you prefer: {% raw %} diff --git a/language/nodejs/configure-ci-cd.md b/language/nodejs/configure-ci-cd.md index 9ce738c7cc..7584791084 100644 --- a/language/nodejs/configure-ci-cd.md +++ b/language/nodejs/configure-ci-cd.md @@ -210,11 +210,16 @@ Next, change your Docker Hub login to a GitHub container registry login: uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_TOKEN }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} ``` {% endraw %} +To authenticate against the [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry), use the [`GITHUB_TOKEN`](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) for the best security and experience. + +You may need to [manage write and read access of GitHub Actions](https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio) for repositories in the container settings. + +You can also use a [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) 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). Remember to change how the image is tagged. The following example keeps ‘latest’ as the only tag. However, you can add any logic to this if you prefer: {% raw %} diff --git a/language/python/configure-ci-cd.md b/language/python/configure-ci-cd.md index 1afc9f005a..98ee61a5cd 100644 --- a/language/python/configure-ci-cd.md +++ b/language/python/configure-ci-cd.md @@ -210,11 +210,16 @@ Next, change your Docker Hub login to a GitHub container registry login: uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_TOKEN }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} ``` {% endraw %} +To authenticate against the [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry), use the [`GITHUB_TOKEN`](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) for the best security and experience. + +You may need to [manage write and read access of GitHub Actions](https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio) for repositories in the container settings. + +You can also use a [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) 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). Remember to change how the image is tagged. The following example keeps ‘latest’ as the only tag. However, you can add any logic to this if you prefer: {% raw %}