Skip to main content
In GitHub Actions, contexts expose metadata and runtime variables that help you automate, customize conditional logic, and debug workflows. This guide shows you how to access and dump various contexts—such as github, runner, job, steps, and secrets—to better understand what data is available during a workflow run.

What are contexts?

A context in GitHub Actions is a set of predefined objects containing information about the event payload, workflow, jobs, steps, secrets, runner environment, and more. You can reference any context property using the ${{ }} syntax.
The image shows a GitHub Docs page about "Contexts" in GitHub Actions, explaining how to access context information in workflows and actions. It includes a warning about security considerations when using contexts.

Runner context

The runner context provides properties like runner.name, runner.os, runner.arch, and more. These can drive conditional logic:
The image shows a GitHub Docs page detailing the "runner context" in GitHub Actions, including property names, types, and descriptions related to the runner executing a job.

Workflow example: dumping contexts

The following context-testing.yml workflow runs on every push and uses the toJSON function to serialize contexts, then echoes them to the log.
The image shows a GitHub Docs page about GitHub Actions, specifically focusing on the "secrets context" used in workflows. It includes a warning about printing secrets and a table describing properties related to secrets.
Never print secrets unmasked in public logs. Secrets may appear in the output of toJSON(secrets) if not handled securely.
You can dump additional contexts like strategy or matrix, or reference individual secrets via secrets.<NAME> (for example, secrets.GITHUB_TOKEN).

Viewing workflow runs

After pushing this workflow, navigate to the Actions tab to see the run in progress or completed status.
The image shows a GitHub Actions page displaying a list of workflow runs with their statuses, branches, and timestamps. The interface is in dark mode, and some workflows are queued while others have completed.

Inspecting logs

Once the workflow completes, open the job logs to view the dumped context values.
The image shows a GitHub Actions log with details of a workflow run, including commit information and repository URLs.

Examples

GitHub context JSON

Repository & user metadata

Job, steps, and runner context output

Finally, the secrets context will list available workflow secrets like GITHUB_TOKEN and any custom secrets you’ve configured.

Watch Video