Expand description
Minimalist utilities for writing custom GitHub Actions.
Macros§
- debug
- Outputs a debug message.
- error
- Outputs an error message.
- notice
- Outputs a notice message.
- warning
- Outputs a warning message.
Structs§
- Illegal
Value Error - Error parsing enumeration values.
Enums§
- GitHub
RefType - Possible values of the GITHUB_REF_TYPE environment variable.
- Runner
Arch - Possible values of the RUNNER_ARCH environment variable.
- Runner
Environment - Possible values of the RUNNER_ENVIRONMENT environment variable.
- Runner
Os - Possible values of the RUNNER_OS environment variable.
Constants§
- CI
- Always set to
true
. - GITHUB_
ACTION - The name of the action currently running, or the id of a step. For example, for an action,
__repo-owner_name-of-action-repo
. - GITHUB_
ACTIONS - Always 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_
ACTION_ PATH - The 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_ REPOSITORY - For a step executing an action, this is the owner and repository name of the action. For example,
actions/checkout
. - GITHUB_
ACTOR - The name of the person or app that initiated the workflow. For example,
octocat
. - GITHUB_
ACTOR_ ID - The account ID of the person or app that triggered the initial workflow run. For example,
1234567
. Note that this is different from the actor username. - GITHUB_
API_ URL - Returns the API URL. For example:
https://api.github.com
. - GITHUB_
BASE_ REF - The 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
orpull_request_target
. For example,main
. - GITHUB_
ENV - The path on the runner to the file that sets variables from workflow commands. 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 “Workflow commands for GitHub Actions.” - GITHUB_
EVENT_ NAME - The name of the event that triggered the workflow. For example,
workflow_dispatch
. - GITHUB_
EVENT_ PATH - The path to the file on the runner that contains the full event webhook payload. For example,
/github/workflow/event.json
. - GITHUB_
GRAPHQL_ URL - Returns the GraphQL API URL. For example:
https://api.github.com/graphql
. - GITHUB_
HEAD_ REF - The 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
orpull_request_target
. For example,feature-branch-1
. - GITHUB_
JOB - The job_id of the current job. For example,
greeting_job
. - GITHUB_
OUTPUT - The path on the runner to the file that sets the current step’s outputs from workflow commands. 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 “Workflow commands for GitHub Actions.” - GITHUB_
PATH - The path on the runner to the file that sets system
PATH
variables from workflow commands. 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 “Workflow commands for GitHub Actions.” - GITHUB_
REF - The fully-formed ref of the branch or tag that triggered the workflow run. For workflows triggered by
push
, this is the branch or tag ref that was pushed. For workflows triggered bypull_request
, this is the pull request merge branch. For workflows triggered byrelease
, this is the release tag created. For other triggers, this is the branch or tag ref that triggered the workflow run. This is only set if a branch or tag is available for the event type. The ref given is fully-formed, meaning that for branches the format isrefs/heads/<branch_name>
, for pull requests it isrefs/pull/<pr_number>/merge
, and for tags it isrefs/tags/<tag_name>
. For example,refs/heads/feature-branch-1
. - GITHUB_
REF_ NAME - The short ref name of the branch or tag that triggered the workflow run. This value matches the branch or tag name shown on GitHub. For example,
feature-branch-1.
- GITHUB_
REF_ PROTECTED true
if branch protections or rulesets are configured for the ref that triggered the workflow run.- GITHUB_
REF_ TYPE - The type of ref that triggered the workflow run. Valid values are
branch
ortag
. - GITHUB_
REPOSITORY - The owner and repository name. For example,
octocat/Hello-World
. - GITHUB_
REPOSITORY_ ID - The ID of the repository. For example,
123456789
. Note that this is different from the repository name. - GITHUB_
REPOSITORY_ OWNER - The repository owner’s name. For example,
octocat
. - GITHUB_
REPOSITORY_ OWNER_ ID - The repository owner’s account ID. For example,
1234567
. Note that this is different from the owner’s name. - GITHUB_
RETENTION_ DAYS - The number of days that workflow run logs and artifacts are kept. For example,
90
. - GITHUB_
RUN_ ATTEMPT - A 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 - A unique number for each workflow run within a repository. This number does not change if you re-run the workflow run. For example,
1658821493
. - GITHUB_
RUN_ NUMBER - A unique number for each run of a particular workflow in a repository. This number begins at 1 for the workflow’s first run, and increments with each new run. This number does not change if you re-run the workflow run. For example,
3
. - GITHUB_
SERVER_ URL - The URL of the GitHub server. For example:
https://github.com
. - GITHUB_
SHA - The commit SHA that triggered the workflow. The value of this commit SHA depends on the event that triggered the workflow. For more information, see “Events that trigger workflows.” For example,
ffac537e6cbbf934b08745a378932722df287a53
. - GITHUB_
STATE - The path on the runner to the file that may be used to share state with pre: and post: actions.
- GITHUB_
STEP_ SUMMARY - The path on the runner to the file that contains job summaries from workflow commands. 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 “Workflow commands for GitHub Actions.” - GITHUB_
TRIGGERING_ ACTOR - The username of the user that initiated the workflow run. If the workflow run is a re-run, this value may differ from
github.actor
. Any workflow re-runs will use the privileges ofgithub.actor
, even if the actor initiating the re-run (github.triggering_actor
) has different privileges. - GITHUB_
WORKFLOW - The name of the workflow. For example,
My test workflow
. If the workflow file doesn’t specify aname
, the value of this variable is the full path of the workflow file in the repository. - GITHUB_
WORKFLOW_ REF - The ref path to the workflow. For example,
octocat/hello-world/.github/workflows/my-workflow.yml@refs/heads/my_branch
. - GITHUB_
WORKFLOW_ SHA - The commit SHA for the workflow file.
- GITHUB_
WORKSPACE - The 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 - The architecture of the runner executing the job. Possible values are
X86
,X64
,ARM
, orARM64
. - RUNNER_
DEBUG - This is set only if debug logging is enabled, and always has the value of
1
. It can be useful as an indicator to enable additional debugging or verbose logging in your own job steps. - RUNNER_
ENVIRONMENT - The environment of the runner executing the job. Possible values are:
github-hosted
for GitHub-hosted runners provided by GitHub, andself-hosted
for self-hosted runners configured by the repository owner. - RUNNER_
NAME - The name of the runner executing the job. This name may not be unique in a workflow run as runners at the repository and organization levels could use the same name. For example,
Hosted Agent
- RUNNER_
OS - The operating system of the runner executing the job. Possible values are
Linux
,Windows
, ormacOS
. For example,Windows
- RUNNER_
TEMP - The path to a temporary directory on the runner. This directory is emptied at the beginning and end of each job. Note that files will not be removed if the runner’s user account does not have permission to delete them. For example,
D:\a\_temp
- RUNNER_
TOOL_ CACHE - The path to the directory containing preinstalled tools for GitHub-hosted runners. For more information, see “Using GitHub-hosted runners”. For example,
C:\hostedtoolcache\windows
Functions§
- append_
name_ value - Appends a
<NAME>=<VALUE>
line to the given file. Suitable for writing to crate::env::GITHUB_ENV, crate::env::GITHUB_OUTPUT, and crate::env::GITHUB_STATE files. The value must not contain the\n
character. - append_
name_ value_ ml - Appends a properly formatted multi-line version of a
<NAME>=<VALUE>
pair. Suitable for writing to the crate::env::GITHUB_ENV file. The supplied delimiter must not occur as a single line anywhere in the value string, and must not contain the\n
character. - ci
- Returns the value of the CI environment variable.
- end_
group - Mark the end of the log line group.
- github_
action - Returns the value of the GITHUB_ACTION environment variable.
- github_
action_ path - Returns the value of the GITHUB_ACTION_PATH environment variable.
- github_
action_ repository - Returns the value of the GITHUB_ACTION_REPOSITORY environment variable.
- github_
actions - Returns the value of the GITHUB_ACTIONS environment variable.
- github_
actor - Returns the value of the GITHUB_ACTOR environment variable.
- github_
actor_ id - Returns the value of the GITHUB_ACTOR_ID environment variable.
- github_
api_ url - Returns the value of the GITHUB_API_URL environment variable.
- github_
base_ ref - Returns the value of the GITHUB_BASE_REF environment variable.
- github_
env - Returns the value of the GITHUB_ENV environment variable.
- github_
event_ name - Returns the value of the GITHUB_EVENT_NAME environment variable.
- github_
event_ path - Returns the value of the GITHUB_EVENT_PATH environment variable.
- github_
graphql_ url - Returns the value of the GITHUB_GRAPHQL_URL environment variable.
- github_
head_ ref - Returns the value of the GITHUB_HEAD_REF environment variable.
- github_
job - Returns the value of the GITHUB_JOB environment variable.
- github_
output - Returns the value of the GITHUB_OUTPUT environment variable.
- github_
path - Returns the value of the GITHUB_PATH environment variable.
- github_
ref - Returns the value of the GITHUB_REF environment variable.
- github_
ref_ name - Returns the value of the GITHUB_REF_NAME environment variable.
- github_
ref_ protected - Returns the value of the GITHUB_REF_PROTECTED environment variable.
- github_
ref_ type - Returns the value of the GITHUB_REF_TYPE environment variable.
- github_
repository - Returns the value of the GITHUB_REPOSITORY environment variable.
- github_
repository_ id - Returns the value of the GITHUB_REPOSITORY_ID environment variable.
- github_
repository_ owner - Returns the value of the GITHUB_REPOSITORY_OWNER environment variable.
- github_
repository_ owner_ id - Returns the value of the GITHUB_REPOSITORY_OWNER_ID environment variable.
- github_
retention_ days - Returns the value of the GITHUB_RETENTION_DAYS environment variable.
- github_
run_ attempt - Returns the value of the GITHUB_RUN_ATTEMPT environment variable.
- github_
run_ id - Returns the value of the GITHUB_RUN_ID environment variable.
- github_
run_ number - Returns the value of the GITHUB_RUN_NUMBER environment variable.
- github_
server_ url - Returns the value of the GITHUB_SERVER_URL environment variable.
- github_
sha - Returns the value of the GITHUB_SHA environment variable.
- github_
state - Returns the value of the GITHUB_STATE environment variable.
- github_
step_ summary - Returns the value of the GITHUB_STEP_SUMMARY environment variable.
- github_
triggering_ actor - Returns the value of the GITHUB_TRIGGERING_ACTOR environment variable.
- github_
workflow - Returns the value of the GITHUB_WORKFLOW environment variable.
- github_
workflow_ ref - Returns the value of the GITHUB_WORKFLOW_REF environment variable.
- github_
workflow_ sha - Returns the value of the GITHUB_WORKFLOW_SHA environment variable.
- github_
workspace - Returns the value of the GITHUB_WORKSPACE environment variable.
- group
- Perform arbitrary logic in the context of a log line group.
- runner_
arch - Returns the value of the RUNNER_ARCH environment variable.
- runner_
debug - Returns the value of the RUNNER_DEBUG environment variable.
- runner_
environment - Returns the value of the RUNNER_ENVIRONMENT environment variable.
- runner_
name - Returns the value of the RUNNER_NAME environment variable.
- runner_
os - Returns the value of the RUNNER_OS environment variable.
- runner_
temp - Returns the value of the RUNNER_TEMP environment variable.
- runner_
tool_ cache - Returns the value of the RUNNER_TOOL_CACHE environment variable.
- start_
group - Mark the start of the log line group.