Context
This document is the complete reference for 12 contexts of AtomGit Action, including property definitions, JSON example content, and availability tables.
AtomGit Action provides 12 contexts to access runtime environment information in workflows. Each context is a JSON object that can be accessed via expressions ${{ context.property }}.
2.1 Overview of Contexts
| Context | Description | Common Access Methods |
|---|---|---|
atomgit | AtomGit platform and event information | ${{ atomgit.event_name }}, ${{ atomgit.sha }} |
env | Custom environment variables for the current step/Job/Workflow | ${{ env.MY_VAR }} |
vars | Organization/project-level configuration variables | ${{ vars.DEPLOY_ENV }} |
job | Current Job information | ${{ job.status }} |
jobs | Results of previously run Jobs in a reusable workflow | ${{ jobs.deploy.result }} |
steps | Information about each step in the current Job | ${{ steps.build.outputs.result }} |
runner | Runner execution environment information | ${{ runner.os }}, ${{ runner.arch }} |
secrets | Encrypted keys | ${{ secrets.DEPLOY_TOKEN }} |
strategy | Matrix strategy information | ${{ strategy.job-index }} |
matrix | Variable values of the current matrix instance | ${{ matrix.version }} |
inputs | Input parameters of workflow_dispatch/workflow_call | ${{ inputs.environment }} |
2.2 Full Properties of atomgit Context
atomgit is a core context specific to AtomGit, providing all information related to the platform and events.
| Property | Type | Description |
|---|---|---|
atomgit.event_name | string | Name of the current triggered event |
atomgit.sha | string | SHA of the triggered commit |
atomgit.ref | string | Triggered reference (full name of branch or tag, such as refs/heads/main) |
atomgit.ref_name | string | Short name of the triggered reference (such as main, v1.0) |
atomgit.ref_type | string | Reference type: branch or tag |
atomgit.event | object | Full payload object of the event |
atomgit.workspace | string | Path of the Runner workspace |
atomgit.action | string | Name of the current Action |
atomgit.token | string | ATOMGIT_TOKEN token (used for API calls) |
atomgit.repository | string | Full name of the repository (e.g., owner/repo) |
atomgit.repositoryUrl | string | Repository URL |
atomgit.run_id | string | Unique ID of the workflow run |
atomgit.run_number | number | Workflow run number |
atomgit.run_attempt | number | Number of workflow retries |
atomgit.workflow | string | Name of the workflow |
atomgit.head_ref | string | PR source branch (only for PR events) |
atomgit.base_ref | string | PR target branch (only for PR events) |
atomgit.server_url | string | Root URL of the AtomGit platform |
atomgit.api_url | string | Base URL of the AtomGit API |
2.3 Event Fields of atomgit.event
push event
| Field | Description |
|---|---|
atomgit.event.ref | Full ref of the push |
atomgit.event.before | SHA before the push |
atomgit.event.after | SHA after the push |
atomgit.event.commits | Array of commit lists |
atomgit.event.commits[].id | SHA of a single commit |
atomgit.event.commits[].message | Commit message |
atomgit.event.commits[].author | Commit author |
atomgit.event.commits[].added | List of added files |
atomgit.event.commits[].modified | List of modified files |
atomgit.event.commits[].removed | List of deleted files |
atomgit.event.base_ref | Base ref (empty for tag pushes) |
atomgit.event.created | Whether it's a newly created ref |
atomgit.event.deleted | Whether it's a deleted ref |
pull_request event
| Field | Description |
|---|---|
atomgit.event.pull_request.number | PR number |
atomgit.event.pull_request.title | PR title |
atomgit.event.pull_request.body | PR description |
atomgit.event.pull_request.state | PR status (open/closed) |
atomgit.event.pull_request.user.login | PR creator |
atomgit.event.pull_request.head.ref | PR source branch name |
atomgit.event.pull_request.head.sha | Latest SHA of the PR source branch |
atomgit.event.pull_request.head.repo.full_name | Full name of the PR source repository |
atomgit.event.pull_request.base.ref | PR target branch name |
atomgit.event.pull_request.base.repo.full_name | Full name of the PR target repository |
atomgit.event.pull_request.labels | List of PR labels |
atomgit.event.pull_request.merged | Whether the PR has been merged |
atomgit.event.pull_request.draft | Whether the PR is a Draft |
atomgit.event.action | PR event action type |
issue_comment event
| Field | Description |
|---|---|
atomgit.event.comment.id | Comment ID |
atomgit.event.comment.body | Comment content |
atomgit.event.comment.user.login | Commenter |
atomgit.event.comment.created_at | Comment creation time |
atomgit.event.issue.number | Issue number |
atomgit.event.issue.title | Issue title |
atomgit.event.issue.state | Issue state |
atomgit.event.issue.pull_request | Whether it is a PR comment (exists if it is a PR) |
atomgit.event.action | Action type |
workflow_dispatch event
| Field | Description |
|---|---|
atomgit.event.inputs | Manual trigger input parameter object |
schedule event
| Field | Description |
|---|---|
atomgit.event.schedule | List of cron expressions |
2.4 Detailed Properties of Other Contexts
env Context
The env context contains variables that have been set in the workflow, job, or step. It does not include variables inherited from the execution environment process.
Example content of the env context:
{
"first_name": "Mona",
"super_duper_var": "totally_awesome"
}
Example usage of the env context:
name: Hi Mascot
on: push
env:
mascot: Mona
super_duper_var: totally_awesome
jobs:
ubuntu_job:
name: Ubuntu Job
runs-on: euler-latest
steps:
- run: echo 'Hi ${{ env.mascot }}' # Hi Mona
- run: echo 'Hi ${{ env.mascot }}' # Hi Octocat
env:
mascot: Octocat
linux_job:
name: Linux Job
runs-on: ubuntu-latest
env:
mascot: Tux
steps:
- run: echo 'Hi ${{ env.mascot }}' # Hi Tux
vars Context
The vars context contains custom configuration variables set at the organization, repository, and environment levels.
Example content of the vars context:
{
"mascot": "Mona"
}
Example usage of the vars context:
on:
workflow_dispatch:
env:
env_var: ${{ vars.ENV_CONTEXT_VAR }}
jobs:
display-variables:
name: ${{ vars.JOB_NAME }}
if: ${{ vars.USE_VARIABLES == 'true' }}
runs-on: ${{ vars.RUNNER }}
environment: ${{ vars.ENVIRONMENT_STAGE }}
steps:
- name: Use variables
run: |
echo "repository variable : $REPOSITORY_VAR"
echo "organization variable : $ORGANIZATION_VAR"
echo "overridden variable : $OVERRIDE_VAR"
echo "variable from shell environment : $env_var"
env:
REPOSITORY_VAR: ${{ vars.REPOSITORY_VAR }}
ORGANIZATION_VAR: ${{ vars.ORGANIZATION_VAR }}
OVERRIDE_VAR: ${{ vars.OVERRIDE_VAR }}
job Context
Example content of the job context:
{
"status": "success"
}
| Field | Description |
|---|---|
job.status | Current job status: success, failure, cancelled |
job.container | Object type, view environment information when the job uses a custom build environment |
steps Context
Example content of the steps context:
{
"checkout": {
"outputs": {},
"outcome": "success",
"conclusion": "success"
},
"generate_number": {
"outputs": { "random_number": "1" },
"outcome": "success",
"conclusion": "success"
}
}
| Property | Description |
|---|---|
steps.<step_id>.outputs | Step output object |
steps.<step_id>.outputs.<name> | Single output value |
steps.<step_id>.outcome | Result of the step completed before applying continue-on-error |
steps.<step_id>.conclusion | Result of the step completed after applying continue-on-error |
runner Context
Example content of the runner context:
{
"os": "Linux",
"arch": "X64",
"name": "Atomgit Actions 2",
"tool_cache": "/opt/hostedtoolcache",
"temp": "/home/runner/work/_temp"
}
| Property | Description |
|---|---|
runner.os | Operating system: Linux |
runner.arch | Architecture: X64, ARM, ARM64 |
runner.name | Runner name |
runner.temp | Path of the runner temporary directory |
runner.tool_cache | Path of the runner tool cache directory |
runner.debug | Whether debug mode is enabled |
secrets Context
Example content of the secrets context:
{
"atomgit_token": "***",
"NPM_TOKEN": "***",
"SUPERSECRET": "***"
}
| Property | Description |
|---|---|
secrets.<NAME> | Retrieve an encrypted key named NAME |
Example usage of the secrets context:
name: Open new issue
on: workflow_dispatch
jobs:
open-issue:
name: Create Issue
runs-on: ubuntu-latest
permissions:
repository: read
issue: write
steps:
- run: |
gh issue --repo ${{ atomgit.repository }} \
create --title "Issue title" --body "Issue body"
env:
GH_TOKEN: ${{ secrets.ATOMGIT_TOKEN }}
matrix Context
{
"os": "ubuntu-latest",
"node": 16
}
Access: ${{ matrix.version }}, ${{ matrix.os }}
inputs Context
{
"build_id": "123456768",
"deploy_target": "deployment_sys_1a",
"perform_deploy": "true"
}
| Property | Description |
|---|---|
inputs.<name> | Value of input parameters defined in workflow_dispatch or workflow_call |
2.5 Context Availability Table
Different locations have different available contexts:
| Context | Workflow Level | Job Level | Step Level | Conditional Expression (if) | In Action |
|---|---|---|---|---|---|
atomgit | ✅ | ✅ | ✅ | ✅ | ✅ |
env | ✅ | ✅ | ✅ | ✅ | ✅ |
vars | ✅ | ✅ | ✅ | ✅ | ✅ |
job | ❌ | ✅ | ✅ | ✅ | ✅ |
jobs | ✅(caller) | ✅(caller) | ✅(caller) | ✅ | ❌ |
steps | ❌ | ✅(after step) | ✅(after current step) | ✅ | ✅ |
runner | ❌ | ✅ | ✅ | ✅ | ✅ |
secrets | ✅ | ✅ | ✅ | ✅ | ✅ |
strategy | ❌ | ✅ | ✅ | ✅ | ❌ |
matrix | ❌ | ✅ | ✅ | ✅ | ❌ |
inputs | ✅ | ✅ | ✅ | ✅ | ✅ |