GitHub Actions Contexts Reference

All GitHub Actions expression contexts and properties with type and availability.

Searchable GitHub Actions context reference covering github, env, vars, secrets, job, steps, runner, matrix, needs and inputs — with each context's key properties, types and where they are available. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How do I reference a context in a GitHub Actions workflow?

Wrap the expression in the dollar-double-brace syntax, for example the run number is referenced as github.run_number inside a ${{ }} block. Contexts are accessed with dot notation and evaluated before the job runs on the runner.

Every GitHub Actions context in one place

GitHub Actions exposes runtime data through contexts — structured objects you read inside ${{ }} expressions to make workflows dynamic. This reference lists each context with its most-used properties, their types, and where each context is available. Search by context name or property path.

The context system

An expression inside ${{ }} is evaluated by the Actions runner before the step runs. Contexts provide all the runtime data those expressions need:

ContextWhat it covers
githubEvent type, repository, branch, SHA, actor, and run metadata
envEnvironment variables set in the workflow file
varsRepository/organisation variables (non-secret configuration)
secretsEncrypted secrets
jobCurrent job’s status and container info
stepsOutputs and status of previously completed steps
runnerThe runner’s OS, architecture, temp dir, and workspace
matrixCurrent matrix dimension values
needsResults and outputs of upstream jobs
inputsWorkflow inputs (for manually triggered or reusable workflows)
strategyMatrix strategy metadata (job count, index, fail-fast setting)

Availability matters as much as value

Some contexts are only populated in certain positions:

  • steps.<id> — only available after a step with that id has completed within the same job
  • needs.<job> — only available when the current job declares that job in its needs: list
  • secrets — not automatically forwarded into composite actions; must be passed as explicit inputs
  • inputs — only available in workflow_call or workflow_dispatch triggered workflows
  • matrix — only available inside jobs that define a strategy.matrix

Referencing an unavailable context evaluates to empty string or null, not an error — which can cause silent failures.

Commonly used properties

github.ref_name       # branch or tag name (e.g. "main", "v1.2.3")
github.sha            # full commit SHA
github.event_name     # "push", "pull_request", "workflow_dispatch", etc.
github.actor          # username who triggered the workflow
github.run_number     # incrementing integer for this workflow's runs
runner.os             # "Linux", "Windows", or "macOS"
job.status            # "success", "failure", "cancelled"
steps.<id>.outputs.<name>   # output written with echo "key=val" >> $GITHUB_OUTPUT
needs.<job>.result    # "success", "failure", "skipped", "cancelled"
strategy.job-index    # 0-based index of this matrix instance

Practical examples

Conditionally deploy only from the main branch:

- if: github.ref_name == 'main'
  run: ./deploy.sh

Pass a value from one step to the next using GITHUB_OUTPUT:

- id: version
  run: echo "tag=$(cat VERSION)" >> "$GITHUB_OUTPUT"
- run: echo "Deploying ${{ steps.version.outputs.tag }}"

Fan out across operating systems:

strategy:
  matrix:
    os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
  - if: runner.os == 'Windows'
    run: echo "Windows-specific step"

Gate a publish job on a successful test job:

publish:
  needs: test
  if: needs.test.result == 'success' && github.ref_name == 'main'

A caution: never print secrets.* values to logs intentionally. GitHub masks them, but transformations (base64, URL-encoding, substring) can produce output that bypasses masking.