Skip to main content

GITHUB_TOKEN

Learn what GITHUB_TOKEN is, how it works, and why it matters for secure automation in GitHub Actions workflows.

About the GITHUB_TOKEN

At the start of each workflow job, GitHub automatically creates a unique GITHUB_TOKEN secret to use in your workflow. You can use the GITHUB_TOKEN to authenticate in the workflow job.

When you enable GitHub Actions, GitHub installs a GitHub App on your repository. The GITHUB_TOKEN secret is a GitHub App installation access token. You can use the installation access token to authenticate on behalf of the GitHub App installed on your repository. The token's permissions are limited to the repository that contains your workflow. For more information, see GITHUB_TOKEN reference.

Before each job begins, GitHub fetches an installation access token for the job. GITHUB_TOKEN은 작업이 완료되거나 최대 24시간 후에 만료됩니다.

The token is also available in the github.token context. For more information, see Contexts reference.

When GITHUB_TOKEN triggers workflow runs

리포지토리의 GITHUB_TOKEN을 사용하여 작업을 수행하는 경우 workflow_dispatchrepository_dispatch를 제외하고 GITHUB_TOKEN이 트리거하는 이벤트는 새 워크플로 실행을 만들지 않습니다. 이렇게 하면 실수로 재귀 워크플로 실행을 만들지 못하도록 방지됩니다. 예를 들어, 워크플로 실행이 리포지토리의 GITHUB_TOKEN을 사용하여 코드를 푸시하는 경우 리포지토리가 push 이벤트 발생 시 실행되도록 구성된 워크플로를 포함하고 있더라도 새 워크플로가 실행되지 않습니다.

GITHUB_TOKEN을 사용하는 GitHub Actions 워크플로에서 푸시한 커밋은 GitHub Pages 빌드를 트리거하지 않습니다.

Next steps