Skip to content

Reference / Contexts

Contexts

A context is a named object that expressions read, such as github.sha or matrix.node. hatchrun CI has eleven. Context names ignore case.

Context Holds Filled in
github The event and the run At run time
env Environment variables from env At run time
vars Organization and repository variables At run time
secrets Organization and repository secrets At run time
inputs Inputs of a manual run At run time
matrix This job’s matrix values At run time
needs Outputs of jobs this job requires At run time
steps Outputs of earlier steps At run time
runner The machine At run time
job The current job At run time
parameters Job and command parameters When the run is planned

Any other name is an error in validate. GitHub’s strategy and jobs contexts do not exist in hatchrun CI.

The event and the run, following GitHub’s github context: github.sha, github.ref, github.ref_name, github.event_name, github.repository, github.actor, and the whole webhook payload as github.event.

.hatchrun/config.yml
jobs:
info:
runs-on: ubuntu-latest
steps:
- run: echo "${{ github.event_name }} on ${{ github.ref }} at ${{ github.sha }}"

Environment variables set by the job’s and the step’s env.

Variables and secrets set in the hatchrun app, for the organization or the repository. See Secrets and variables. A name that is not set reads as an empty string.

.hatchrun/config.yml
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- run: ./deploy.sh
env:
TOKEN: ${{ secrets.DEPLOY_TOKEN }}
REGION: ${{ vars.REGION }}

The inputs of a manual run, as declared in on.workflow_dispatch.inputs. Empty for every other event.

The values of this job’s matrix combination, one property per key.

needs.ID.outputs.NAME reads the outputs of a job this job requires. ID is the required entry’s id.

steps.ID.outputs.NAME reads the outputs of an earlier step in the same job that has id: ID.

Information about the machine and the current job, following GitHub’s runner and job contexts.

${{ parameters.NAME }} reads a job or command parameter. hatchrun replaces it when it plans the run, so only a whole ${{ parameters.NAME }} works. See Reading parameters.