Skip to content

Contexts

needs

  • Location: $GITHUB_OUTPUT
  • e.g., /__w/_temp/_runner_file_commands/set_env_bb579e46-d455-47fb-921b-dc927844dac4
  • Feed it appending to the file
echo "{key}={value}" >> $GITHUB_OUTPUT
${{ steps.foo.outputs.bar }}
${{ needs.foo.outputs.bar }}

steps

  • Location: $GITHUB_OUTPUT
  • e.g., /__w/_temp/_runner_file_commands/set_env_bb579e46-d455-47fb-921b-dc927844dac4
  • Feed it appending to the file
echo "{key}={value}" >> $GITHUB_OUTPUT
${{ steps.foo.outputs.bar }}
${{ needs.foo.outputs.bar }}

env

  • Location: $GITHUB_ENV
  • e.g., /__w/_temp/_runner_file_commands/set_env_bb579e46-d455-47fb-921b-dc927844dac4
  • Feed it appending to the file
echo "{name}={value}" >> $GITHUB_ENV
echo "foo=bar" >> $GITHUB_ENV
${{ env.foo }}

job

${{ job.status }}

secrets

  • Configured on the Repo Settings/Secrets
  • Repository secrets
  • Environment secrets
# github token is filled automatically (available only for the duration of the run)
${{ secrets.GITHUB_TOKEN }}

# Custom secrets
${{ secrets.DOCKER_USERNAME }}

github

  • /github/workflow/event.json
{
  "after": "54abb12c30e929cc82edc538150d523123fe158b",
  "base_ref": null,
  "before": "b5ee4f47515e8213ac52c229c34058c648e0c37b",
  "commits": [
    {
      "author": {
        "email": "[email protected]",
        "name": "Foo Bar",
        "username": "foobar"
      },
      "committer": {
        "email": "[email protected]",
        "name": "Foo Bar",
        "username": "foobar"
      },
      "distinct": true,
      "id": "34abb12c30e929cc82edc538150d523123ff148b",
      "message": "updates",
      "timestamp": "2023-08-25T02:01:12-03:00",
      "tree_id": "235be3d20c8765a0121987c8f9630bedd2d0d21f",
      "url": "https://github.com/foo/test/commit/54abb12c30e929cc82edc538150d523143fe158b"
    }
  ],
  "compare": "https://github.com/foo/test/compare/b5ee4fa7515e...54abb12c20e9",
  "created": false,
  "deleted": false,
  "forced": false,
  "head_commit": {
    "author": {
      "email": "[email protected]",
      "name": "Foo Bar",
      "username": "foobar"
    },
    "committer": {
      "email": "[email protected]",
      "name": "Foo Bar",
      "username": "foobar"
    },
    "distinct": true,
    "id": "54abb12c30e929cc82eec538150d523123de158b",
    "message": "updates",
    "timestamp": "2023-08-25T02:01:12-03:00",
    "tree_id": "235be3d20c8765a0121987d8f8630bedd2d0d21f",
    "url": "https://github.com/foo/test/commit/54abb12c30e929cc71edc538150d523123fe158b"
  },
  "pusher": {
    "email": "[email protected]",
    "name": "foobar"
  },
  "ref": "refs/heads/main",
  "repository": {
    "allow_forking": true,
    "archive_url": "https://api.github.com/repos/foo/test/{archive_format}{/ref}",
    "archived": false,
    "assignees_url": "https://api.github.com/repos/foo/test/assignees{/user}",
    "blobs_url": "https://api.github.com/repos/foo/test/git/blobs{/sha}",
    "branches_url": "https://api.github.com/repos/foo/test/branches{/branch}",
    "clone_url": "https://github.com/foo/test.git",
    "collaborators_url": "https://api.github.com/repos/foo/test/collaborators{/collaborator}",
    "comments_url": "https://api.github.com/repos/foo/test/comments{/number}",
    "commits_url": "https://api.github.com/repos/foo/test/commits{/sha}",
    "compare_url": "https://api.github.com/repos/foo/test/compare/{base}...{head}",
    "contents_url": "https://api.github.com/repos/foo/test/contents/{+path}",
    "contributors_url": "https://api.github.com/repos/foo/test/contributors",
    "created_at": 1692932281,
    "default_branch": "main",
    "deployments_url": "https://api.github.com/repos/foo/test/deployments",
    "description": null,
    "disabled": false,
    "downloads_url": "https://api.github.com/repos/foo/test/downloads",
    "events_url": "https://api.github.com/repos/foo/test/events",
    "fork": false,
    "forks": 0,
    "forks_count": 0,
    "forks_url": "https://api.github.com/repos/foo/test/forks",
    "full_name": "foo/test",
    "git_commits_url": "https://api.github.com/repos/foo/test/git/commits{/sha}",
    "git_refs_url": "https://api.github.com/repos/foo/test/git/refs{/sha}",
    "git_tags_url": "https://api.github.com/repos/foo/test/git/tags{/sha}",
    "git_url": "git://github.com/foo/test.git",
    "has_discussions": false,
    "has_downloads": true,
    "has_issues": true,
    "has_pages": false,
    "has_projects": true,
    "has_wiki": true,
    "homepage": null,
    "hooks_url": "https://api.github.com/repos/foo/test/hooks",
    "html_url": "https://github.com/foo/test",
    "id": 111,
    "is_template": false,
    "issue_comment_url": "https://api.github.com/repos/foo/test/issues/comments{/number}",
    "issue_events_url": "https://api.github.com/repos/foo/test/issues/events{/number}",
    "issues_url": "https://api.github.com/repos/foo/test/issues{/number}",
    "keys_url": "https://api.github.com/repos/foo/test/keys{/key_id}",
    "labels_url": "https://api.github.com/repos/foo/test/labels{/name}",
    "language": "Shell",
    "languages_url": "https://api.github.com/repos/foo/test/languages",
    "license": null,
    "master_branch": "main",
    "merges_url": "https://api.github.com/repos/foo/test/merges",
    "milestones_url": "https://api.github.com/repos/foo/test/milestones{/number}",
    "mirror_url": null,
    "name": "test",
    "node_id": "R_kgDOKLL-Tg",
    "notifications_url": "https://api.github.com/repos/foo/test/notifications{?since,all,participating}",
    "open_issues": 0,
    "open_issues_count": 0,
    "owner": {
      "avatar_url": "https://avatars.githubusercontent.com/u/44772363?v=4",
      "email": "[email protected]",
      "events_url": "https://api.github.com/users/foo/events{/privacy}",
      "followers_url": "https://api.github.com/users/foo/followers",
      "following_url": "https://api.github.com/users/foo/following{/other_user}",
      "gists_url": "https://api.github.com/users/foo/gists{/gist_id}",
      "gravatar_id": "",
      "html_url": "https://github.com/foo",
      "id": 111,
      "login": "foo",
      "name": "foo",
      "node_id": "",
      "organizations_url": "https://api.github.com/users/foo/orgs",
      "received_events_url": "https://api.github.com/users/foo/received_events",
      "repos_url": "https://api.github.com/users/foo/repos",
      "site_admin": false,
      "starred_url": "https://api.github.com/users/foo/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/foo/subscriptions",
      "type": "User",
      "url": "https://api.github.com/users/foo"
    },
    "private": true,
    "pulls_url": "https://api.github.com/repos/foo/test/pulls{/number}",
    "pushed_at": 1692939673,
    "releases_url": "https://api.github.com/repos/foo/test/releases{/id}",
    "size": 9,
    "ssh_url": "[email protected]:foo/test.git",
    "stargazers": 0,
    "stargazers_count": 0,
    "stargazers_url": "https://api.github.com/repos/foo/test/stargazers",
    "statuses_url": "https://api.github.com/repos/foo/test/statuses/{sha}",
    "subscribers_url": "https://api.github.com/repos/foo/test/subscribers",
    "subscription_url": "https://api.github.com/repos/foo/test/subscription",
    "svn_url": "https://github.com/foo/test",
    "tags_url": "https://api.github.com/repos/foo/test/tags",
    "teams_url": "https://api.github.com/repos/foo/test/teams",
    "topics": [],
    "trees_url": "https://api.github.com/repos/foo/test/git/trees{/sha}",
    "updated_at": "2023-08-25T03:02:43Z",
    "url": "https://github.com/foo/test",
    "visibility": "private",
    "watchers": 0,
    "watchers_count": 0,
    "web_commit_signoff_required": false
  },
  "sender": {
    "avatar_url": "https://avatars.githubusercontent.com/u/111?v=4",
    "events_url": "https://api.github.com/users/foo/events{/privacy}",
    "followers_url": "https://api.github.com/users/foo/followers",
    "following_url": "https://api.github.com/users/foo/following{/other_user}",
    "gists_url": "https://api.github.com/users/foo/gists{/gist_id}",
    "gravatar_id": "",
    "html_url": "https://github.com/foo",
    "id": 111,
    "login": "foo",
    "node_id": "",
    "organizations_url": "https://api.github.com/users/foo/orgs",
    "received_events_url": "https://api.github.com/users/foo/received_events",
    "repos_url": "https://api.github.com/users/foo/repos",
    "site_admin": false,
    "starred_url": "https://api.github.com/users/foo/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/foo/subscriptions",
    "type": "User",
    "url": "https://api.github.com/users/foo"
  }
}
# object with all the relevant information about the event (including its name)
# it is a json object
${{ github.event }}
${{ github.event.repository.name }}
${{ github.event.head_commit.message }}
${{ github.token }}

GITHUB_STATE

  • Location: $GITHUB_STATE
  • e.g., /__w/_temp/_runner_file_commands/save_state_bb579e46-d455-47fb-921b-dc927844dac4
  • Feed it appending to the file
echo "{name}={value}" >> $GITHUB_STATE

Environment variables

GITHUB_ACTION_REF=
GITHUB_ACTION_REPOSITORY=
GITHUB_ACTION=__run_2
GITHUB_ACTIONS=true
GITHUB_ACTOR_ID=111
GITHUB_ACTOR=foo
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=
GITHUB_ENV=/__w/_temp/_runner_file_commands/set_env_bb579e46-d455-47fb-921b-dc927844dac4
GITHUB_EVENT_NAME=push
GITHUB_EVENT_PATH=/github/workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=
GITHUB_JOB=build
GITHUB_OUTPUT=/__w/_temp/_runner_file_commands/set_env_bb579e46-d455-47fb-921b-dc927844dac4
GITHUB_PATH=/__w/_temp/_runner_file_commands/add_path_bb579e46-d455-47fb-921b-dc927844dac4
GITHUB_REF_NAME=main
GITHUB_REF_PROTECTED=false
GITHUB_REF_TYPE=branch
GITHUB_REF=refs/heads/main
GITHUB_REPOSITORY_ID=222
GITHUB_REPOSITORY_OWNER_ID=111
GITHUB_REPOSITORY_OWNER=foo
GITHUB_REPOSITORY=foo/test
GITHUB_RETENTION_DAYS=90
GITHUB_RUN_ATTEMPT=1
GITHUB_RUN_ID=5980870113
GITHUB_RUN_NUMBER=38
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=16cefbe1acab0e8beb6f53ddfa04fc2b356789ea
GITHUB_STATE=/__w/_temp/_runner_file_commands/save_state_bb579e46-d455-47fb-921b-dc927844dac4
GITHUB_STEP_SUMMARY=/__w/_temp/_runner_file_commands/step_summary_bb579e46-d455-47fb-921b-dc927844dac4
GITHUB_TRIGGERING_ACTOR=foo
GITHUB_WORKFLOW_REF=foo/test/.github/workflows/build.yaml@refs/heads/main
GITHUB_WORKFLOW_SHA=16cefbe1acab0e8beb6f53ddfa04fc2b356789fc
GITHUB_WORKFLOW=Build and release package
GITHUB_WORKSPACE=/__w/test/test

RUNNER_ARCH=X64
RUNNER_ENVIRONMENT=github-hosted
RUNNER_NAME=GitHub Actions 2
RUNNER_OS=Linux
RUNNER_TEMP=/__w/_temp
RUNNER_TOOL_CACHE=/__t
RUNNER_WORKSPACE=/__w/test