Skip to content

Commit 5a58e4f

Browse files
authored
[Improvement]: Update documentation to clarify lifetime of GITHUB_TOKEN #19798 (#59860)
1 parent b410b46 commit 5a58e4f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

content/actions/concepts/security/github_token.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ At the start of each workflow job, {% data variables.product.prodname_dotcom %}
1313

1414
When you enable {% data variables.product.prodname_actions %}, {% data variables.product.prodname_dotcom %} installs a {% data variables.product.prodname_github_app %} on your repository. The `GITHUB_TOKEN` secret is a {% data variables.product.prodname_github_app %} installation access token. You can use the installation access token to authenticate on behalf of the {% data variables.product.prodname_github_app %} installed on your repository. The token's permissions are limited to the repository that contains your workflow. For more information, see [AUTOTITLE](/actions/reference/workflow-syntax-for-github-actions#permissions).
1515

16-
Before each job begins, {% data variables.product.prodname_dotcom %} fetches an installation access token for the job. {% data reusables.actions.github-token-expiration %}
16+
Before each job begins, {% data variables.product.github %} fetches an installation access token for the job. The `GITHUB_TOKEN` expires when the job finishes or after its effective maximum lifetime.
17+
18+
The effective maximum lifetime of the token depends on the type of runner:
19+
20+
* **{% data variables.product.github %}-hosted runners** The maximum job execution time is 6 hours, so the `GITHUB_TOKEN` can live for a maximum of 6 hours.
21+
* **Self-hosted runners** The maximum job execution time is 5 days. However, because the `GITHUB_TOKEN` is an installation access token, it can only be refreshed for up to 24 hours. If your job runs longer than 24 hours, use a {% data variables.product.pat_generic %} or other authentication method instead.
1722

1823
The token is also available in the `github.token` context. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts#github-context).
1924

0 commit comments

Comments
 (0)