From bb17f61c51a362eda87a662e1baf324be3f3fd37 Mon Sep 17 00:00:00 2001 From: Mark Maxwell <138938022+mark-mxwl@users.noreply.github.com> Date: Tue, 2 Jan 2024 02:38:41 -0600 Subject: [PATCH] Update all articles where GITHUB_TOKEN should appear as GH_TOKEN (#30770) Co-authored-by: Sarah Edwards --- .../adding-labels-to-issues.md | 4 ++-- ...mmenting-on-an-issue-when-a-label-is-added.md | 2 +- .../scheduling-issue-creation.md | 2 +- .../using-workflows/triggering-a-workflow.md | 8 ++++---- .../using-github-cli-in-workflows.md | 8 ++++---- ...-a-github-app-in-a-github-actions-workflow.md | 2 +- .../automating-dependabot-with-github-actions.md | 4 ++-- .../annotating-code-examples.md | 4 ++-- .../using-markdown-and-liquid-in-github-docs.md | 2 +- .../automating-projects-using-actions.md | 16 ++++++++-------- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/content/actions/managing-issues-and-pull-requests/adding-labels-to-issues.md b/content/actions/managing-issues-and-pull-requests/adding-labels-to-issues.md index 89740264cb34..f0df8970c9e8 100644 --- a/content/actions/managing-issues-and-pull-requests/adding-labels-to-issues.md +++ b/content/actions/managing-issues-and-pull-requests/adding-labels-to-issues.md @@ -46,14 +46,14 @@ In the tutorial, you will first make a workflow file that uses the {% data varia steps: - run: gh issue edit "$NUMBER" --add-label "$LABELS" env: - GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} GH_REPO: {% raw %}${{ github.repository }}{% endraw %} NUMBER: {% raw %}${{ github.event.issue.number }}{% endraw %} LABELS: triage ``` 1. Customize the `env` values in your workflow file: - - The `GITHUB_TOKEN`, `GH_REPO`, and `NUMBER` values are automatically set using the `github` and `secrets` contexts. You do not need to change these. + - The `GH_TOKEN`, `GH_REPO`, and `NUMBER` values are automatically set using the `github` and `secrets` contexts. You do not need to change these. - Change the value for `LABELS` to the list of labels that you want to add to the issue. The label(s) must exist for your repository. Separate multiple labels with commas. For example, `help wanted,good first issue`. For more information about labels, see "[AUTOTITLE](/issues/using-labels-and-milestones-to-track-work/managing-labels#applying-labels-to-issues-and-pull-requests)." 1. {% data reusables.actions.commit-workflow %} diff --git a/content/actions/managing-issues-and-pull-requests/commenting-on-an-issue-when-a-label-is-added.md b/content/actions/managing-issues-and-pull-requests/commenting-on-an-issue-when-a-label-is-added.md index db54bcb0f893..621b12c1a310 100644 --- a/content/actions/managing-issues-and-pull-requests/commenting-on-an-issue-when-a-label-is-added.md +++ b/content/actions/managing-issues-and-pull-requests/commenting-on-an-issue-when-a-label-is-added.md @@ -45,7 +45,7 @@ In the tutorial, you will first make a workflow file that uses the `gh issue com - name: Add comment run: gh issue comment "$NUMBER" --body "$BODY" env: - GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} GH_REPO: {% raw %}${{ github.repository }}{% endraw %} NUMBER: {% raw %}${{ github.event.issue.number }}{% endraw %} BODY: > diff --git a/content/actions/managing-issues-and-pull-requests/scheduling-issue-creation.md b/content/actions/managing-issues-and-pull-requests/scheduling-issue-creation.md index be24b44a9b8a..fbc2f017a4aa 100644 --- a/content/actions/managing-issues-and-pull-requests/scheduling-issue-creation.md +++ b/content/actions/managing-issues-and-pull-requests/scheduling-issue-creation.md @@ -63,7 +63,7 @@ In the tutorial, you will first make a workflow file that uses the {% data varia gh issue pin "$new_issue_url" fi env: - GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} GH_REPO: {% raw %}${{ github.repository }}{% endraw %} TITLE: Team sync ASSIGNEES: monalisa,doctocat,hubot diff --git a/content/actions/using-workflows/triggering-a-workflow.md b/content/actions/using-workflows/triggering-a-workflow.md index 5f85462da595..eb82df92d17a 100644 --- a/content/actions/using-workflows/triggering-a-workflow.md +++ b/content/actions/using-workflows/triggering-a-workflow.md @@ -53,13 +53,13 @@ jobs: runs-on: ubuntu-latest steps: - env: - GITHUB_TOKEN: {% raw %}${{ secrets.MY_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.MY_TOKEN }}{% endraw %} ISSUE_URL: {% raw %}${{ github.event.issue.html_url }}{% endraw %} run: | gh issue edit $ISSUE_URL --add-label "triage" ``` -Conversely, the following workflow uses `GITHUB_TOKEN` to add a label to an issue. It will not trigger any workflows that run when a label is added. +Conversely, the following workflow uses `GITHUB_TOKEN ` to add a label to an issue. It will not trigger any workflows that run when a label is added. ```yaml on: @@ -72,7 +72,7 @@ jobs: runs-on: ubuntu-latest steps: - env: - GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} ISSUE_URL: {% raw %}${{ github.event.issue.html_url }}{% endraw %} run: | gh issue edit $ISSUE_URL --add-label "triage" @@ -172,7 +172,7 @@ jobs: steps: - name: "Comment about changes we can't accept" env: - GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} PR: {% raw %}${{ github.event.pull_request.html_url }}{% endraw %} run: | gh pr edit $PR --add-label 'invalid' diff --git a/content/actions/using-workflows/using-github-cli-in-workflows.md b/content/actions/using-workflows/using-github-cli-in-workflows.md index 0ef75ef33c1b..961384bdb943 100644 --- a/content/actions/using-workflows/using-github-cli-in-workflows.md +++ b/content/actions/using-workflows/using-github-cli-in-workflows.md @@ -19,7 +19,7 @@ type: how_to {% data reusables.cli.cli-learn-more %} -{% data variables.product.prodname_cli %} is preinstalled on all {% data variables.product.prodname_dotcom %}-hosted runners. For each step that uses {% data variables.product.prodname_cli %}, you must set an environment variable called `GITHUB_TOKEN` to a token with the required scopes. +{% data variables.product.prodname_cli %} is preinstalled on all {% data variables.product.prodname_dotcom %}-hosted runners. For each step that uses {% data variables.product.prodname_cli %}, you must set an environment variable called `GH_TOKEN` to a token with the required scopes. You can execute any {% data variables.product.prodname_cli %} command. For example, this workflow uses the `gh issue comment` subcommand to add a comment when an issue is opened. @@ -35,7 +35,7 @@ jobs: steps: - run: gh issue comment $ISSUE --body "Thank you for opening this issue!" env: - GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} ISSUE: {% raw %}${{ github.event.issue.html_url }}{% endraw %} ``` @@ -64,11 +64,11 @@ jobs: echo 'NUM_OPEN_ISSUES='$numOpenIssues >> $GITHUB_ENV env: - GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} OWNER: {% raw %}${{ github.repository_owner }}{% endraw %} REPO: {% raw %}${{ github.event.repository.name }}{% endraw %} - run: | gh issue create --title "Issue report" --body "$NUM_OPEN_ISSUES issues remaining" --repo $GITHUB_REPOSITORY env: - GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} ``` diff --git a/content/apps/creating-github-apps/authenticating-with-a-github-app/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow.md b/content/apps/creating-github-apps/authenticating-with-a-github-app/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow.md index 4bd6c992ae0d..31a4c95c8a00 100644 --- a/content/apps/creating-github-apps/authenticating-with-a-github-app/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow.md +++ b/content/apps/creating-github-apps/authenticating-with-a-github-app/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow.md @@ -56,7 +56,7 @@ jobs: - name: Use the token env: - GITHUB_TOKEN: {% raw %}${{ steps.generate_token.outputs.token }}{% endraw %} + GH_TOKEN: {% raw %}${{ steps.generate_token.outputs.token }}{% endraw %} run: | gh api octocat ``` diff --git a/content/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions.md b/content/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions.md index f9f90da97722..cb397de713c5 100644 --- a/content/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions.md +++ b/content/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions.md @@ -222,7 +222,7 @@ jobs: run: gh pr review --approve "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} ``` {% endraw %} @@ -266,7 +266,7 @@ jobs: run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} ``` {% endraw %} diff --git a/content/contributing/writing-for-github-docs/annotating-code-examples.md b/content/contributing/writing-for-github-docs/annotating-code-examples.md index 943b9b820a7d..ffaa521b78cb 100644 --- a/content/contributing/writing-for-github-docs/annotating-code-examples.md +++ b/content/contributing/writing-for-github-docs/annotating-code-examples.md @@ -87,7 +87,7 @@ jobs: steps: - run: gh pr comment $PR_URL --body "Welcome to the repository!" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_URL: ${{ github.event.pull_request.html_url }} ``` @@ -117,6 +117,6 @@ jobs: steps: - run: gh pr comment $PR_URL --body "Welcome to the repository!" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_URL: ${{ github.event.pull_request.html_url }} ``` diff --git a/content/contributing/writing-for-github-docs/using-markdown-and-liquid-in-github-docs.md b/content/contributing/writing-for-github-docs/using-markdown-and-liquid-in-github-docs.md index 8e5af1dee934..108c70727f0c 100644 --- a/content/contributing/writing-for-github-docs/using-markdown-and-liquid-in-github-docs.md +++ b/content/contributing/writing-for-github-docs/using-markdown-and-liquid-in-github-docs.md @@ -133,7 +133,7 @@ Code annotations only work in articles with the `layout: inline` frontmatter pro steps: - run: gh pr comment $PR_URL --body "Welcome to the repository!" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_URL: ${{ github.event.pull_request.html_url }} ``` diff --git a/content/issues/planning-and-tracking-with-projects/automating-your-project/automating-projects-using-actions.md b/content/issues/planning-and-tracking-with-projects/automating-your-project/automating-projects-using-actions.md index 92b15ebbe120..cb189ee5ef52 100644 --- a/content/issues/planning-and-tracking-with-projects/automating-your-project/automating-projects-using-actions.md +++ b/content/issues/planning-and-tracking-with-projects/automating-your-project/automating-projects-using-actions.md @@ -91,7 +91,7 @@ jobs: # Replace `YOUR_PROJECT_NUMBER` with your project number. To find the project number, look at the project URL. For example, `https://github.com/orgs/octo-org/projects/5` has a project number of 5. - name: Get project data env: - GITHUB_TOKEN: {% raw %}${{ steps.generate_token.outputs.token }}{% endraw %} + GH_TOKEN: {% raw %}${{ steps.generate_token.outputs.token }}{% endraw %} ORGANIZATION: YOUR_ORGANIZATION PROJECT_NUMBER: YOUR_PROJECT_NUMBER # Uses [{% data variables.product.prodname_cli %}](https://cli.github.com/manual/) to query the API for the ID of the project and return the name and ID of the first 20 fields in the project. `fields` returns a union and the query uses inline fragments (`... on`) to return information about any `ProjectV2Field` and `ProjectV2SingleSelectField` fields. The response is stored in a file called `project_data.json`. @@ -132,10 +132,10 @@ jobs: echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV echo 'TODO_OPTION_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .options[] | select(.name=="Todo") |.id' project_data.json) >> $GITHUB_ENV -# Sets environment variables for this step. `GITHUB_TOKEN` is the token generated in the first step. `PR_ID` is the ID of the pull request that triggered this workflow. +# Sets environment variables for this step. `GH_TOKEN` is the token generated in the first step. `PR_ID` is the ID of the pull request that triggered this workflow. - name: Add PR to project env: - GITHUB_TOKEN: {% raw %}${{ steps.generate_token.outputs.token }}{% endraw %} + GH_TOKEN: {% raw %}${{ steps.generate_token.outputs.token }}{% endraw %} PR_ID: {% raw %}${{ github.event.pull_request.node_id }}{% endraw %} # Uses [{% data variables.product.prodname_cli %}](https://cli.github.com/manual/) and the API to add the pull request that triggered this workflow to the project. The `jq` flag parses the response to get the ID of the created item. run: | @@ -155,10 +155,10 @@ jobs: - name: Get date run: echo "DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV -# Sets environment variables for this step. `GITHUB_TOKEN` is the token generated in the first step. +# Sets environment variables for this step. `GH_TOKEN` is the token generated in the first step. - name: Set fields env: - GITHUB_TOKEN: {% raw %}${{ steps.generate_token.outputs.token }}{% endraw %} + GH_TOKEN: {% raw %}${{ steps.generate_token.outputs.token }}{% endraw %} # Sets the value of the `Status` field to `Todo`. Sets the value of the `Date posted` field. run: | gh api graphql -f query=' @@ -223,7 +223,7 @@ jobs: # Replace `YOUR_PROJECT_NUMBER` with your project number. To find the project number, look at the project URL. For example, `https://github.com/orgs/octo-org/projects/5` has a project number of 5. - name: Get project data env: - GITHUB_TOKEN: {% raw %}${{ secrets.YOUR_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.YOUR_TOKEN }}{% endraw %} ORGANIZATION: YOUR_ORGANIZATION PROJECT_NUMBER: YOUR_PROJECT_NUMBER # Uses [{% data variables.product.prodname_cli %}](https://cli.github.com/manual/) to query the API for the ID of the project and return the name and ID of the first 20 fields in the project. `fields` returns a union and the query uses inline fragments (`... on`) to return information about any `ProjectV2Field` and `ProjectV2SingleSelectField` fields. The response is stored in a file called `project_data.json`. @@ -267,7 +267,7 @@ jobs: # Sets environment variables for this step. Replace `YOUR_TOKEN` with the name of the secret that contains your {% data variables.product.pat_generic %}. - name: Add PR to project env: - GITHUB_TOKEN: {% raw %}${{ secrets.YOUR_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.YOUR_TOKEN }}{% endraw %} PR_ID: {% raw %}${{ github.event.pull_request.node_id }}{% endraw %} # Uses [{% data variables.product.prodname_cli %}](https://cli.github.com/manual/) and the API to add the pull request that triggered this workflow to the project. The `jq` flag parses the response to get the ID of the created item. run: | @@ -290,7 +290,7 @@ jobs: # Sets environment variables for this step. Replace `YOUR_TOKEN` with the name of the secret that contains your {% data variables.product.pat_generic %}. - name: Set fields env: - GITHUB_TOKEN: {% raw %}${{ secrets.YOUR_TOKEN }}{% endraw %} + GH_TOKEN: {% raw %}${{ secrets.YOUR_TOKEN }}{% endraw %} # Sets the value of the `Status` field to `Todo`. Sets the value of the `Date posted` field. run: | gh api graphql -f query='