Skip to main content

Variables reference

Find information for supported variables, naming conventions, limits, and contexts in GitHub Actions workflows.

This article lists the supported variables you can use in GitHub Actions workflows, including environment variables, configuration variables, and default variables provided by GitHub. Use this reference to look up variable names, naming conventions, limits, and supported contexts when configuring your workflows.

For more information about variables, see Variables.

Default environment variables

The default environment variables that GitHub sets are available to every step in a workflow.

Because default environment variables are set by GitHub and not defined in a workflow, they are not accessible through the env context. However, most of the default variables have a corresponding, and similarly named, context property. For example, the value of the GITHUB_REF variable can be read during workflow processing using the ${{ github.ref }} context property.

GITHUB_*RUNNER_*(으)로 명명된 기본 환경 변수의 값에 덮어쓸 수 없습니다. 현재 CI 변수 값을 덮어쓸 수 있습니다. 그러나, 이것이 항상 가능할 것이라고 보장되지는 않습니다. For more information about setting environment variables, see 변수에 정보 저장 and GitHub Actions에 대한 워크플로 명령.

We strongly recommend that actions use variables to access the filesystem rather than using hardcoded file paths. GitHub sets variables for actions to use in all runner environments.

VariableDescription
CIAlways set to true.
GITHUB_ACTIONThe name of the action currently running, or the id of a step. For example, for an action, __repo-owner_name-of-action-repo.

GitHub removes special characters, and uses the name __run when the current step runs a script without an id. If you use the same script or action more than once in the same job, the name will include a suffix that consists of the sequence number preceded by an underscore. For example, the first script you run will have the name __run, and the second script will be named __run_2. Similarly, the second invocation of actions/checkout will be actionscheckout2.
GITHUB_ACTION_PATHThe path where an action is located. This property is only supported in composite actions. You can use this path to change directories to where the action is located and access other files in that same repository. For example, /home/runner/work/_actions/repo-owner/name-of-action-repo/v1.
GITHUB_ACTION_REPOSITORYFor a step executing an action, this is the owner and repository name of the action. For example, actions/checkout.
GITHUB_ACTIONSAlways set to true when GitHub Actions is running the workflow. You can use this variable to differentiate when tests are being run locally or by GitHub Actions.
GITHUB_ACTORThe name of the person or app that initiated the workflow. For example, octocat.
GITHUB_ACTOR_ID최초로 워크플로 실행을 트리거한 사용자 또는 앱의 계정 ID입니다. 예를 들어 1234567입니다. 행위자 사용자 이름과는 다릅니다.
GITHUB_API_URLReturns the API URL. For example: http(s)://HOSTNAME/api/v3.
GITHUB_BASE_REFThe name of the base ref or target branch of the pull request in a workflow run. This is only set when the event that triggers a workflow run is either pull_request or pull_request_target. For example, main.
GITHUB_ENVThe path on the runner to the file that sets variables from workflow commands. The path to this file is unique to the current step and changes for each step in a job. For example, /home/runner/work/_temp/_runner_file_commands/set_env_87406d6e-4979-4d42-98e1-3dab1f48b13a. For more information, see GitHub Actions에 대한 워크플로 명령.
GITHUB_EVENT_NAMEThe name of the event that triggered the workflow. For example, workflow_dispatch.
GITHUB_EVENT_PATHThe path to the file on the runner that contains the full event webhook payload. For example, /github/workflow/event.json.
GITHUB_GRAPHQL_URLReturns the GraphQL API URL. For example: http(s)://HOSTNAME/api/graphql.
GITHUB_HEAD_REFThe head ref or source branch of the pull request in a workflow run. This property is only set when the event that triggers a workflow run is either pull_request or pull_request_target. For example, feature-branch-1.
GITHUB_JOBThe job_id of the current job. For example, greeting_job.
GITHUB_OUTPUTThe path on the runner to the file that sets the current step's outputs from workflow commands. The path to this file is unique to the current step and changes for each step in a job. For example, /home/runner/work/_temp/_runner_file_commands/set_output_a50ef383-b063-46d9-9157-57953fc9f3f0. For more information, see GitHub Actions에 대한 워크플로 명령.
GITHUB_PATHThe path on the runner to the file that sets system PATH variables from workflow commands. The path to this file is unique to the current step and changes for each step in a job. For example, /home/runner/work/_temp/_runner_file_commands/add_path_899b9445-ad4a-400c-aa89-249f18632cf5. For more information, see GitHub Actions에 대한 워크플로 명령.
GITHUB_REF워크플로 실행을 트리거한 분기 또는 태그의 완전한 형식 참조 입니다. push에 의해 트리거된 워크플로의 경우 푸시된 분기 또는 태그 참조입니다. pull_request에 의해 트리거된 워크플로의 경우 끌어오기 요청 병합 분기입니다. release에 의해 트리거된 워크플로의 경우 생성된 릴리스 태그입니다. 다른 트리거의 경우 워크플로 실행을 트리거한 분기 또는 태그 참조입니다. 이벤트 유형에 대해 분기 또는 태그를 사용할 수 있는 경우에만 설정됩니다. 지정된 참조는 완전한 형식을 가집니다. 즉, 분기의 형식은 refs/heads/<branch_name>입니다. pull_request_target을 제외한 끌어오기 요청 이벤트의 경우는 refs/pull/<pr_number>/merge입니다. pull_request_target 이벤트에는 베이스 분기의 ref가 있습니다. 태그의 경우에는 refs/tags/<tag_name>입니다. 예를 들어 refs/heads/feature-branch-1입니다.
GITHUB_REF_NAME워크플로 실행을 트리거한 분기 또는 태그입니다. 해당 값은 GitHub에 표시된 분기 또는 태그 이름과 일치합니다. 예를 들어 feature-branch-1입니다.

끌어오기 요청의 경우 형식은 <pr_number>/merge입니다.
GITHUB_REF_PROTECTED분기 보호가 워크플로 실행을 트리거한 ref에 대해 구성된 경우 true입니다.
GITHUB_REF_TYPE워크플로 실행을 트리거한 ref의 형식입니다. 유효한 값은 branch 또는 tag입니다.
GITHUB_REPOSITORYThe owner and repository name. For example, octocat/Hello-World.
GITHUB_REPOSITORY_ID리포지토리 ID. 예를 들어 123456789입니다. 리포지토리 이름과는 다릅니다.
GITHUB_REPOSITORY_OWNERThe repository owner's name. For example, octocat.
GITHUB_REPOSITORY_OWNER_ID리포지토리 소유자 계정 ID. 예를 들어 1234567입니다. 소유자의 이름과는 다른 값입니다.
GITHUB_RETENTION_DAYSThe number of days that workflow run logs and artifacts are kept. For example, 90.
GITHUB_RUN_ATTEMPTA unique number for each attempt of a particular workflow run in a repository. This number begins at 1 for the workflow run's first attempt, and increments with each re-run. For example, 3.
GITHUB_RUN_ID리포지토리 내에서 실행되는 각 워크플로의 고유한 숫자입니다. 워크플로 실행을 다시 실행하는 경우 이 숫자는 변경되지 않습니다. For example, 1658821493.
GITHUB_RUN_NUMBER리포지토리에 있는 특정 워크플로의 실행마다 고유한 숫자입니다. 이 숫자는 워크플로의 첫 실행 시 1부터 시작하며 새 실행마다 증가합니다. 워크플로 실행을 다시 실행하는 경우 이 숫자는 변경되지 않습니다. For example, 3.
GITHUB_SERVER_URLThe URL of the GitHub server. For example: https://HOSTNAME.
GITHUB_SHA워크플로를 트리거한 커밋 SHA입니다. 이 커밋 SHA의 값은 워크플로를 트리거한 이벤트에 따라 달라집니다. 자세한 내용은 워크플로를 트리거하는 이벤트을(를) 참조하세요. 예를 들어 ffac537e6cbbf934b08745a378932722df287a53입니다.
GITHUB_STEP_SUMMARYThe path on the runner to the file that contains job summaries from workflow commands. The path to this file is unique to the current step and changes for each step in a job. For example, /home/runner/_layout/_work/_temp/_runner_file_commands/step_summary_1cb22d7f-5663-41a8-9ffc-13472605c76c. For more information, see GitHub Actions에 대한 워크플로 명령.
GITHUB_TRIGGERING_ACTOR워크플로 실행을 시작한 사용자의 사용자 이름입니다. 워크플로 실행이 다시 실행인 경우 이 값은 github.actor와 다를 수 있습니다. 다시 실행을 시작하는 행위자(github.triggering_actor)가 다른 권한을 갖고 있더라도 모든 워크플로 다시 실행은 github.actor의 권한을 사용합니다.
GITHUB_WORKFLOWThe name of the workflow. For example, My test workflow. If the workflow file doesn't specify a name, the value of this variable is the full path of the workflow file in the repository.
GITHUB_WORKFLOW_REF워크플로의 참조 경로입니다. 예를 들어 octocat/hello-world/.github/workflows/my-workflow.yml@refs/heads/my_branch입니다.
GITHUB_WORKFLOW_SHA워크플로 파일의 커밋 SHA입니다.
GITHUB_WORKSPACEThe default working directory on the runner for steps, and the default location of your repository when using the checkout action. For example, /home/runner/work/my-repo-name/my-repo-name.
RUNNER_ARCH작업을 실행하는 실행기의 아키텍처입니다. 가능한 값은 X86, X64, ARM, ARM64입니다.
RUNNER_DEBUG디버그 로깅을 사용하도록 설정한 경우에만 설정되며 항상 값이 1입니다. 사용자 고유의 작업 단계에서 추가 디버깅 또는 자세한 로깅을 사용하도록 설정하는 지표로 유용할 수 있습니다.
RUNNER_ENVIRONMENT작업을 실행하는 실행기의 환경입니다. 가능한 값은 GitHub에서 제공하는 GitHub 호스트형 실행기의 경우 github-hosted, 리포지토리 소유자가 구성한 자체 호스트형 실행기의 경우 self-hosted입니다.
RUNNER_NAME작업을 실행하는 실행기의 이름입니다. 실행기 이름은 리포지토리의 실행기로 워크플로 실행 시 고유하지 않을 수 있으며 조직 수준에서 동일한 이름을 사용할 수 있습니다. For example, Hosted Agent
RUNNER_OS작업을 실행하는 실행기의 운영 체제입니다. 가능한 값은 Linux, Windows, 또는 macOS입니다. For example, Windows
RUNNER_TEMP실행기의 임시 디렉터리에 대한 경로입니다. 이 디렉터리는 각 작업의 시작과 끝에 비워집니다. 실행기 사용자 계정에 삭제 권한이 없는 경우 파일이 제거되지 않습니다. For example, D:\a\_temp
RUNNER_TOOL_CACHEGitHub 호스팅 실행기에 대해 미리 설치된 도구가 포함된 디렉터리의 경로입니다. 자세한 내용은 GitHub 호스팅 실행기 사용을(를) 참조하세요. For example, C:\hostedtoolcache\windows

참고 항목

If you need to use a workflow run's URL from within a job, you can combine these variables: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID

Naming conventions for configuration variables

The following rules apply to configuration variable names:

  • 영숫자 문자([a-z], [A-Z], [0-9]) 또는 밑줄(_)만 포함할 수 있습니다. 공백은 사용할 수 없습니다.
  • GITHUB_ 접두사로 시작하지 않아야 합니다.
  • 숫자로 시작할 수 없습니다.
  • 참조할 때 대/소문자를 구분하지 않습니다. GitHub는 입력 방법에 관계없이 비밀 이름을 대문자로 저장합니다.
  • 리포지토리, 조직, 해당 리포지토리가 만들어진 엔터프라이즈에 고유해야 합니다.

Naming conventions for environment variables

When you set an environment variable, you cannot use any of the default environment variable names. For a complete list of default environment variables, see Variables reference below. If you attempt to override the value of one of these default variables, the assignment is ignored.

참고 항목

You can list the entire set of environment variables that are available to a workflow step by using run: env in a step and then examining the output for the step.

Configuration variable precedence

If a variable with the same name exists at multiple levels, the variable at the lowest level takes precedence. For example, if an organization-level variable has the same name as a repository-level variable, then the repository-level variable takes precedence. Similarly, if an organization, repository, and environment all have a variable with the same name, the environment-level variable takes precedence.

For reusable workflows, the variables from the caller workflow's repository are used. Variables from the repository that contains the called workflow are not made available to the caller workflow.

Limits for configuration variables

Individual variables are limited to 48 KB in size.

You can store up to 1,000 organization variables, 500 variables per repository, and 100 variables per environment. The total combined size limit for organization and repository variables is 10 MB per workflow run.

A workflow created in a repository can access the following number of variables:

  • Up to 500 repository variables, if the total size of repository variables is less than 10 MB. If the total size of repository variables exceeds 10 MB, only the repository variables that fall below the limit will be available (as sorted alphabetically by variable name).
  • Up to 1,000 organization variables, if the total combined size of repository and organization variables is less than 10 MB. If the total combined size of organization and repository variables exceeds 10 MB, only the organization variables that fall below that limit will be available (after accounting for repository variables and as sorted alphabetically by variable name).
  • Up to 100 environment-level variables.

참고 항목

Environment-level variables do not count toward the 10 MB total size limit. If you exceed the combined size limit for repository and organization variables and still need additional variables, you can use an environment and define additional variables in the environment.

Supported contexts

You will commonly use either the env or github context to access variable values in parts of the workflow that are processed before jobs are sent to runners.

경고

Do not print the github context to logs. It contains sensitive information.

ContextUse caseExample
envReference custom variables defined in the workflow.${{ env.MY_VARIABLE }}
githubReference information about the workflow run and the event that triggered the run.${{ github.repository }}