Accessing the runtime environment

New release: GitHub Actions is now available in a new limited public beta. This version offers a new workflow configuration and built-in continuous integration and continuous deployment capabilities. We strongly recommend you avoid using it for high-value workflows and content during this public beta period. To request to join the limited public beta, see the GitHub Actions page. For more information, see "About GitHub Actions" in the GitHub Help documentation.

GitHub Support will only provide support for the YAML syntax and no longer provides support for the HCL syntax.

If you participated in the limited public beta and created workflows with the HCL syntax GitHub Actions, you will need to upgrade to the new limited public beta that uses YAML syntax. When your repository is eligible to upgrade, you'll see an invitation in your repository. You must accept the invitation before you can use the new limited public beta.

Once you've upgraded, any workflows that you created with the HCL syntax will need to be updated to the new YAML syntax. To automatically convert your workflows, see "Migrating GitHub Actions from HCL syntax to YAML syntax" in the GitHub Help documentation.

GitHub Actions execute in a runtime environment with access to a filesystem and environment variables to perform tasks.

All actions that are part of a workflow execute in the same runtime environment, which allows actions to share information with actions that run later in the workflow.

Runtime environment resources

Actions execute in a runtime environment with these resources:

  • 1 virtual CPU
  • Up to 3.75 GB of memory
  • Remote network access
  • Environment variables describing current workflow context
  • Write access to the filesystem
  • 100 GB of disk space

Environment variables

An action can create, read, and modify environment variables. When you create an action in a workflow, you can define environment variables using the env attribute in your action block.

Environment variables can be created in the visual workflow editor, or set in the main.workflow file inside of an action block. For example, you could set the variables FIRST_NAME, MIDDLE_NAME, and LAST_NAME using this example action block:

action "Hello World" {
  uses = "./my-action"
  env = {
    FIRST_NAME  = "Mona"
    MIDDLE_NAME = "Lisa"
    LAST_NAME   = "Octocat"

When an action runs, GitHub also sets these environment variables in the runtime environment:

Environment variable Description
HOME The path to the GitHub home directory used to store user data. Value: /github/home.
GITHUB_WORKFLOW The name of the workflow.
GITHUB_ACTION The name of the action.
GITHUB_ACTOR The name of the person or app that initiated the workflow. For example, octocat.
GITHUB_REPOSITORY The owner and repository name. For example, octocat/Hello-World.
GITHUB_EVENT_NAME The webhook name of the event that triggered the workflow.
GITHUB_EVENT_PATH The path to a file that contains the payload of the event that triggered the workflow. Value: /github/workflow/event.json.
GITHUB_WORKSPACE The GitHub workspace path. Value: /github/workspace.
Note: GitHub actions must be run by the default Docker user (root). Ensure your Dockerfile does not set the USER instruction, otherwise you will not be able to access GITHUB_WORKSPACE.
GITHUB_SHA The commit SHA that triggered the workflow.
GITHUB_REF The branch or tag ref that triggered the workflow. For example, refs/heads/feature-branch-1. If neither a branch or tag is available for the event type, the variable will not exist.
GITHUB_TOKEN A GitHub App installation token scoped to the repository containing the workflow file. To access this environment variable from an action, you must add the GITHUB_TOKEN secret to each action that requires access. This variable is not available to an action by default. To learn more about GitHub Action secrets, see "Storing secrets."

Naming conventions

Any new environment variables you set that point to a location on the file system should have a _PATH suffix. The HOME and GITHUB_WORKSPACE default variables are exceptions to this convention because the words "home" and "workspace" already imply a location.

Note: GitHub reserves the GITHUB_ environment variable prefix for internal use by GitHub. Setting an environment variable or secret with the GITHUB_ prefix will result in an error.


GitHub reserves the /github path prefix and creates three directories with information about the repository that actions can use to perform a task:

Directory Description
/github/home A directory containing user-related data. For example, this directory could contain credentials from a login attempt. This directory path is set in the HOME environment variable.
/github/workspace The working directory of the Docker container. GitHub Actions execute in this directory. The path to this directory is set in the GITHUB_WORKSPACE environment variable. This directory contains a copy of the repository (with version GITHUB_SHA) that triggered the workflow. An action can modify the contents of this directory, which subsequent actions can access. Note: GitHub actions must be run by the default Docker user (root). Ensure your Dockerfile does not set the USER instruction, otherwise you will not be able to access GITHUB_WORKSPACE.
/github/workflow/event.json The POST response of the webhook event that triggered the workflow. GitHub rewrites this each time an action executes, so that the file content is isolated between actions. This file path is set in the GITHUB_EVENT_PATH environment variable.

Exit codes and statuses

You can use exit codes to provide an action's status. GitHub uses the exit code to set the GitHub Action's check run status, which can be success, neutral, or failure:

Exit status Check run status Description
0 success The action completed successfully and other tasks that depends on it can begin.
78 neutral The configuration error exit status (EX_CONFIG) indicates that the action terminated but did not fail. For example, a filter action can use a neutral status to stop a workflow if certain conditions aren't met. When an action returns this exit status, GitHub terminates all concurrently running actions and prevents any future actions from starting. The associated check run shows a neutral status, and the overall check suite will have a status of success as long as there were no failed or cancelled actions.
All other codes failure Any other exit code indicates the action failed. When an action fails, all concurrent actions are cancelled and future actions are skipped. The check run and check suite both get a failure status.