跳到主要内容

Contexts

Introduces the definitions of available contexts in the AtomGit Pipeline workflow, including available properties, access methods, and usage examples.

2.1 Available Contexts​

Context NameTypeDescription
atomgitobjectInformation about the workflow run. For more information, see atomgit.
envobjectVariables set within a workflow, job, or step. For more information, see env.
varsobjectVariables set at the repository, organization, or environment level. For more information, see vars.
jobobjectInformation about the currently running job. For more information, see job.
jobsobjectReusable workflow only. Contains outputs from jobs in reusable workflows. For more information, see jobs.
stepsobjectInformation about steps that ran in the current job. For more information, see steps.
runnerobjectInformation about the runner executing the current job. For more information, see runner.
secretsobjectNames and values of secrets available to the workflow run. For more information, see secret.
strategyobjectInformation about the matrix strategy used for the current job. For more information, see strategy.
matrixobjectAttributes related to the matrix configured in the workflow that applies to the current job. For more information, see matrix.
inputsobjectInput properties passed to an action, reusable workflow, or manually triggered workflow. For more information, see inputs.

As part of an expression, you can access context information using one of the following two syntaxes:

  • Index syntax: atomgit['sha']
  • Property dereferencing syntax: atomgit.sha To use the property dereferencing syntax, the property name must start with a letter or _ and can only contain alphanumeric characters, -, or _.

If you try to reference an attribute that does not exist, it will evaluate to an empty string.

Determining When to Use Contexts​

  • Default environment variables: These environment variables only exist on the runner executing your job.
  • Contexts: You can use most contexts at any time throughout the workflow, even when default variables are unavailable. For example, you can use contexts with expressions to perform initial processing before tasks are routed to a runner for execution; this allows you to use contexts associated with the conditional if keyword to determine whether a step should run. Once a job starts running, you can also retrieve context variables from the runner where it executes, such as runner.os. The following example demonstrates how to use these different types of variables together in a job:
name: CI
on:
push:
branches: main
jobs:
prod-check:
if: ${{ atomgit.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Run echo
run: echo "Deploying to production server on branch $ATOMGIT_REF"

In this example, the if statement checks the atomgit context to determine the current branch name; if the name is refs/heads/main, the subsequent steps execute. The if check is processed by AtomGit Pipeline, and the task is only sent to the runner for execution if the result is true. Once the task is sent to the runner, the steps execute and reference the variables.

Context Availability​

Different contexts become available at different times during the workflow run. For example, the secrets context may only be usable in specific locations within a job.

Additionally, some functions may only be available in certain locations. For example, the hashFiles function is not available everywhere.

The table below lists usage limitations for each context and special function in the workflow. Contexts listed are only available for the given workflow key and cannot be used elsewhere. Functions can be used anywhere unless listed below.

Workflow ScenarioAvailable ContextsSpecial Functions
run-nameatomgit, inputs, varsNone
concurrencyatomgit, inputs, varsNone
envatomgit, secrets, inputs, varsNone
jobs.<job_id>.concurrencyatomgit, strategy, matrix, inputs, varsNone
jobs.<job_id>.containeratomgit, strategy, matrix, vars, inputsNone
jobs.<job_id>.container.credentialsatomgit, strategy, matrix, env, vars, secrets, inputsNone
jobs.<job_id>.container.env.<env_id>atomgit, strategy, matrix, job, runner, env, vars, secrets, inputsNone
jobs.<job_id>.container.imageatomgit, strategy, matrix, vars, inputsNone
jobs.<job_id>.continue-on-erroratomgit, strategy, vars, matrix, inputsNone
jobs.<job_id>.defaults.runatomgit, strategy, matrix, env, vars, inputsNone
jobs.<job_id>.envatomgit, strategy, matrix, vars, secrets, inputsNone
jobs.<job_id>.ifatomgit, vars, inputsalways, cancelled, success, failure
jobs.<job_id>.nameatomgit, strategy, matrix, vars, inputsNone
jobs.<job_id>.outputs.<output_id>atomgit, strategy, matrix, job, runner, env, vars, secrets, steps, inputsNone
jobs.<job_id>.runs-onatomgit, strategy, matrix, vars, inputsNone
jobs.<job_id>.secrets.<secrets_id>atomgit, strategy, matrix, secrets, inputs, varsNone
jobs.<job_id>.steps.continue-on-erroratomgit, strategy, matrix, job, runner, env, vars, secrets, steps, inputshashFiles
jobs.<job_id>.steps.envatomgit, strategy, matrix, job, runner, env, vars, secrets, steps, inputshashFiles
jobs.<job_id>.steps.ifatomgit, strategy, matrix, job, runner, env, vars, steps, inputsalways, cancelled, success, failure, hashFiles
jobs.<job_id>.steps.nameatomgit, strategy, matrix, job, runner, env, vars, secrets, steps, inputshashFiles
jobs.<job_id>.steps.runatomgit, strategy, matrix, job, runner, env, vars, secrets, steps, inputshashFiles
jobs.<job_id>.steps.timeout-minutesatomgit, strategy, matrix, job, runner, env, vars, secrets, steps, inputshashFiles
jobs.<job_id>.steps.withatomgit, strategy, matrix, job, runner, env, vars, secrets, steps, inputshashFiles
jobs.<job_id>.steps.working-directoryatomgit, strategy, matrix, job, runner, env, vars, secrets, steps, inputshashFiles
jobs.<job_id>.strategyatomgit, vars, inputsNone
jobs.<job_id>.timeout-minutesatomgit, strategy, matrix, vars, inputsNone
jobs.<job_id>.with.<with_id>atomgit, strategy, matrix, inputs, varsNone
on.workflow_call.inputs.<inputs_id>.defaultatomgit, inputs, varsNone
on.workflow_call.outputs.<output_id>.valueatomgit, jobs, vars, inputsNone

Example: Printing Context Information to Logs​

You can print the contents of contexts to the log for debugging purposes. toJson is required to pretty-print JSON objects to the log.

[!WARNING] When using the entire atomgit context, be aware that it contains sensitive information such as atomgit.token. AtomGit Pipeline masks keys when printing them to the console, but you should exercise caution when exporting or printing contexts.

name: Context testing

on:
push:
branches: main



jobs:

dump_contexts_to_log:

runs-on: ubuntu-latest

steps:

- name: Dump Atomgit context

env:

ATOMGIT_CONTEXT: ${{ toJson(atomgit) }}

run: echo "$ATOMGIT_CONTEXT"

- name: Dump job context

env:

JOB_CONTEXT: ${{ toJson(job) }}

run: echo "$JOB_CONTEXT"

- name: Dump steps context

env:

STEPS_CONTEXT: ${{ toJson(steps) }}

run: echo "$STEPS_CONTEXT"

- name: Dump runner context

env:

RUNNER_CONTEXT: ${{ toJson(runner) }}

run: echo "$RUNNER_CONTEXT"

- name: Dump strategy context

env:

STRATEGY_CONTEXT: ${{ toJson(strategy) }}

run: echo "$STRATEGY_CONTEXT"

- name: Dump matrix context

env:

MATRIX_CONTEXT: ${{ toJson(matrix) }}

run: echo "$MATRIX_CONTEXT"

2.2 atomgit Context​

The atomgit context contains information about the workflow run and the event that triggered it. You can read most atomgit context data in environment variables.

[!WARNING] When using the entire atomgit context, be aware that it contains sensitive information such as atomgit.token. AtomGit Pipeline masks keys when printing them to the console, but you should exercise caution when exporting or printing contexts. [!WARNING] When creating workflows and actions, you should always consider whether your code might execute untrusted input from potential attackers. Some contexts should be treated as untrusted input because attackers could insert malicious content.

Attribute NameTypeDescription
atomgitobjectTop-level context available during any job or step in the workflow. This object contains all attributes listed below.
atomgit.actionstringThe name of the currently running action, or step's . AtomGit Pipeline removes special characters, and when the current step runs a script without an id, it uses the name __run. If the same action is used multiple times in the same job, the name will include an underscore sequence suffix. For example, the first script you run will be named __run, and the second will be named __run_2. Similarly, the second call to actions/checkoutwould beactionscheckout2`.
atomgit.action_pathstringThe path where the action resides. This attribute is only supported in composite actions. You can use this path to access files in the same repository as the action, for example by changing directory to the path: cd ${{ atomgit.action_path }}.
atomgit.action_refstringFor steps executing an action, this is the reference of the action being executed. For example, v2. Do not use in run keywords. To make this context work with composite actions, reference it in the composite action's env context.
atomgit.action_repositorystringFor steps executing an action, this is the owner and repository name of the action. For example, actions/checkout. Do not use in run keywords. To make this context work with composite actions, reference it in the composite action's env context.
atomgit.actorstringThe username of the user who triggered the initial workflow run. If the workflow run is a rerun, this value may differ from atomgit.triggering_actor. Any workflow rerun will use the permissions of atomgit.actor, even if the initiator of the rerun (atomgit.triggering_actor) has different permissions.
atomgit.actor_idstringThe account ID of the person or application that triggered the initial workflow run. For example, 1234567. Note that this differs from the actor username.
atomgit.api_urlstringThe URL of the AtomGit REST API.
atomgit.base_refstringThe base_ref or target branch of the pull request in the workflow run. This attribute is only available when the event triggering the workflow run is pull_request or pull_request_target.
atomgit.envstringThe path to the file on the runner where environment variables are set from workflow commands. This file is unique to the current step, and each step in the job uses a different file.
atomgit.eventobjectThe complete event webhook payload. You can use this context to access individual attributes of the event. This object is identical to the webhook payload of the event that triggered the workflow run and varies for each event. Links to webhooks for each AtomGit Pipeline event are in . For example, for a workflow run triggered by , this object contains the contents of .
atomgit.event_namestringThe name of the event that triggered the workflow run. Includes Push, MR, Note, IssueComment, Scheduler.
atomgit.event_pathstringThe path to the file on the runner containing the complete event webhook payload.
atomgit.head_refstringThe head_ref or source branch of the pull request in the workflow run. This attribute is only available when the event triggering the workflow run is pull_request or pull_request_target.
atomgit.jobstringThe for the current job. Note: This context attribute is set by the Actions execution environment and is only available in the execution steps of a job. Otherwise, the value of this attribute is null.
atomgit.pathstringThe path to the file on the runner where the system PATH variable is set from workflow commands. This file is unique to the current step, and each step in the job uses a different file.
atomgit.refstringThe full reference of the branch or tag that triggered the workflow run. For push-triggered workflows, this is the pushed branch or tag reference. For unmerged pull_request-triggered workflows, this is the pull request merge branch. If the pull request is merged, this is the main branch. For release-triggered workflows, this is the created release tag. For other triggers, this is the branch or tag reference that triggered the workflow run. This reference is only set if there is an available branch or tag for the event type. The given reference is complete, meaning for branches, the format is refs/heads/<branch_name>. For unmerged pull request events except pull_request_target, it is refs/pull/<pr_number>/merge. pull_request_target events have a ref from the base branch. For tags, it is refs/tags/<tag_name>. For example, refs/heads/feature-branch-1.
atomgit.ref_namestringThe short reference name of the branch or tag that triggered the workflow run. This value matches the branch or tag name displayed on AtomGit. For example, feature-branch-1. For unmerged pull requests, the format is <pr_number>/merge.
atomgit.ref_typestringThe type of reference that triggered the workflow run. Valid values are branch or tag.
atomgit.repositorystringOwner and repository name. For example, octocat/Hello-World.
atomgit.repository_idstringThe ID of the repository. For example, 123456789. Note that this differs from the repository name.
atomgit.stringThe Git URL of the repository. For example, git://atomgit.com/octocat/hello-world.git.
atomgit.retention_daysstringThe number of days to retain workflow run logs and artifacts.
atomgit.run_idstringA unique number for each workflow run in the repository. This number does not change if you rerun the workflow run.
atomgit.run_numberstringA unique number for each run of a specific workflow in the repository. This number starts at 1 for the first run of the workflow and increments with each new run. This number does not change if you rerun the workflow run.
atomgit.run_attemptstringA unique number for each attempt of a specific workflow run in the repository. This number starts at 1 for the first attempt of the workflow run and increments with each rerun.
atomgit.server_urlstringThe URL of the AtomGit server. For example: https://atomgit.com.
atomgit.shastringThe commit SHA that triggered the workflow. The value of this commit SHA depends on the event that triggered the workflow. For example, ffac537e6cbbf934b08745a378932722df287a53.
atomgit.tokenstringThe token used to authenticate as the AtomGit App installed in your repository. This is functionally equivalent to the ATOMGIT_TOKEN secret. Note: This context attribute is set by the Actions execution environment and is only available in the execution steps of a job. Otherwise, the value of this attribute is null.
atomgit.triggering_actorstringThe username of the user who initiated the workflow run. If the workflow run is a rerun, this value may differ from atomgit.actor. Any workflow rerun will use the permissions of atomgit.actor, even if the initiator of the rerun (atomgit.triggering_actor) has different permissions.
atomgit.workflowstringThe name of the workflow. If the workflow file does not specify a name, the value of this attribute is the full path of the workflow file in the repository.
atomgit.workflow_refstringThe reference path of the workflow. For example, octocat/hello-world/.atomgit/workflows/my-workflow.yml@refs/heads/my_branch.
atomgit.workflow_shastringThe commit SHA of the workflow file.
atomgit.workspacestringThe default working directory for steps on the runner, as well as the default location of your repository when using the action.
atomgit.start_timestampstringThe timestamp when the workflow started.

2.3 atomgit.event​

Overview​

atomgit.event is a sub-object under the atomgit context that carries the event payload that triggered the current workflow run. When an event triggers a workflow, the platform mounts the complete payload of that event directly under atomgit.event for the workflow to read via expressions.

atomgit.event is 100% isomorphic to the event's Webhook payload: field names, nesting levels, and value meanings are completely identical. Therefore, the payload structure you see in the Webhook documentation can be accessed directly in the workflow in the form of atomgit.event.<field_path>. For example, comment.body in the payload becomes atomgit.event.comment.body in the workflow.

Fields mounted under atomgit.event vary depending on the triggering event. All events share a set of common base fields (action, sender, repository, etc.), and each event appends its own proprietary fields. This section explains them by event scenario.

Note

  • atomgit.event.action represents the event's activity type (e.g., created, edited), which is not the same field as the top-level context atomgit.action (current step identifier); do not confuse them.
  • Fields marked "only xxx" only appear under corresponding activity types and will return empty values when read under other activity types.
  • Fields like head_commit, merged_at, review.body may be null under specific conditions; it is recommended to check for null before use.
  • The "Value" column of tables annotates the complete set of enumerated values for enum-type fields; fields not annotated accept free-form values.

Common Base Fields (Shared by All Events)​

The following fields exist in atomgit.event for all events and will not be repeated in subsequent scenarios.

Access PathTypeValueDescription
atomgit.event.actionstringDepends on the event, see scenariosEvent activity type; push events do not have this field. Commonly used to distinguish actions in if conditions
atomgit.event.sender.idinteger—User ID that triggered the event
atomgit.event.sender.loginstring—Initiator login name, used to identify who triggered the run
atomgit.event.repository.idinteger—Repository ID
atomgit.event.repository.namestring—Repository name
atomgit.event.repository.full_namestring—Full repository name (owner/repo), commonly used when constructing API addresses
atomgit.event.repository.default_branchstring—Repository default branch name
atomgit.event.repository.privatebooleantrue / falseWhether it is a private repository, affects Fork and credential policies

Event Correspondence to atomgit.event_name​

Event Typeatomgit.event_name Value
workflow_dispatchManual
workflow_callFollows the main workflow's event_name
pushPush
pull_requestMR
pull_requestMR
pull_request_targetMR
pull_request_commentNote
issue_commentIssueComment
scheduleScheduler

push Event​

Triggered upon code push. This event has no action field; the payload focuses on references and commit information for the current push.

Access PathTypeValueDescription
atomgit.event.refstring—Full reference pushed, e.g., refs/heads/main, commonly used as a branch filter basis
atomgit.event.beforestring—Commit SHA pointed to by the reference before push; all zeros for new branches
atomgit.event.afterstring—Commit SHA pointed to by the reference after push;
atomgit.event.createdbooleantrue / falseWhether this push creates a new reference
atomgit.event.base_refstring—Reference source for new branch creation, otherwise null
atomgit.event.head_commit.idstring—SHA of the latest commit after push; null for deleted branches
atomgit.event.head_commit.messagestring—Message of the latest commit after push

pull_request Event​

Triggered when activities occur on the Pull Request itself, including opening, closing, editing, syncing, assigning, adding/removing labels, etc.

Activity Types:

ValueTrigger Condition
openedPR is created
updatedPR title or description is edited
closedPR is closed (check merged field to see if it was merged)
reopenedClosed PR is reopened

Fields:

Access PathTypeValueDescription
atomgit.event.numberinteger—PR number, sibling redundant field with the same value as pull_request.number
atomgit.event.pull_request.idinteger—PR ID
atomgit.event.pull_request.numberinteger—PR number, primary key for replying to comments and calling APIs
atomgit.event.pull_request.titlestring—PR title
atomgit.event.pull_request.bodystring—PR description
atomgit.event.pull_request.statestringopen / closedPR state
atomgit.event.pull_request.draftbooleantrue / falseWhether it is a draft PR; drafts often skip CI
atomgit.event.pull_request.mergedbooleantrue / falseWhether it is merged; combined with closed to judge "merged rather than just closed"
atomgit.event.pull_request.merged_atstring—Merge time, null if not merged
atomgit.event.pull_request.user.loginstring—PR submitter login name
atomgit.event.pull_request.labelsarray—Label list, can be used to route pipelines by label
atomgit.event.pull_request.head.refstring—Source branch name
atomgit.event.pull_request.head.shastring—Source branch latest commit SHA, used when explicitly checking out PR code
atomgit.event.pull_request.merge_commit_shastring—PR scenario pre-merge head commit
atomgit.event.pull_request.head.repo.full_namestring—Source repository full name; differs from base in Fork scenarios, used to judge external PRs
atomgit.event.pull_request.base.refstring—Target branch name, commonly used as a branch filter basis
atomgit.event.pull_request.base.shastring—Target branch latest commit SHA
atomgit.event.pull_request.base.repo.full_namestring—Target repository full name, i.e., the repository where the workflow resides
atomgit.event.pull_request.created_atstring—PR creation time
atomgit.event.pull_request.updated_atstring—PR last update time

issue_comment Event​

Triggered when a comment in the main Issue comment thread is created, edited, or deleted.

Activity Types: created(comment posted), edited(comment edited), deleted(comment deleted).

Access PathTypeValueDescription
atomgit.event.issue.idinteger—Issue ID
atomgit.event.issue.numberinteger—Issue number, primary key for replying to comments
atomgit.event.issue.titlestring—Issue title
atomgit.event.issue.bodystring—Issue body
atomgit.event.issue.statestringopen / closedIssue state
atomgit.event.issue.user.loginstring—Issue creator
atomgit.event.issue.labelsarray—Issue label list
atomgit.event.comment.idinteger—Comment ID, primary key for replying or updating comments
atomgit.event.comment.bodystring—Comment content, can be used to parse commands like /deploy
atomgit.event.comment.user.loginstring—Comment author
atomgit.event.comment.author_associationstringOWNER / MEMBER / COLLABORATOR / CONTRIBUTOR / FIRST_TIME_CONTRIBUTOR / FIRST_TIMER / NONERelationship between comment author and repository, used as permission filter basis
atomgit.event.comment.created_atstring—Comment creation time
atomgit.event.comment.updated_atstring—Comment last update time

When deleted, comment is a snapshot of the comment before deletion.

pull_request_comment Event​

Triggered when a comment in the Pull Request main comment area (Conversation tab) is created, edited, or deleted. Structure is symmetric to issue_comment, with issue replaced by pull_request.

Activity Types:

created, edited, deleted, meanings identical to issue_comment.

Access PathTypeValueDescription
atomgit.event.pull_request.numberinteger—PR number to which the comment belongs
atomgit.event.pull_request.statestringopen / closedPR state
atomgit.event.pull_request.user.loginstring—PR submitter
atomgit.event.pull_request.head.refstring—Source branch name
atomgit.event.pull_request.head.shastring—Source branch latest commit SHA, used for checkout when triggering CI reruns via comment
atomgit.event.pull_request.merge_commit_shastring—PR scenario pre-merge head commit
atomgit.event.pull_request.head.repo.full_namestring—Source repository full name, used to judge if it is an external Fork
atomgit.event.pull_request.base.refstring—Target branch name, commonly used as a branch filter basis
atomgit.event.pull_request.base.repo.full_namestring—Target repository full name
atomgit.event.comment.idinteger—Comment ID
atomgit.event.comment.bodystring—Comment content, can be used to parse commands
atomgit.event.comment.user.loginstring—Comment author
atomgit.event.comment.author_associationstringOWNER / MEMBER / COLLABORATOR / CONTRIBUTOR / FIRST_TIME_CONTRIBUTOR / FIRST_TIMER / NONERelationship between comment author and repository, used as permission filter basis
atomgit.event.comment.created_atstring—Comment creation time
atomgit.event.comment.updated_atstring—Comment last update time

2.4 Detailed Properties of Other Contexts​

env Context​

The env context contains variables set in the workflow, job, or step. It does not include variables inherited by processes in the execution environment.

You can retrieve the values of variables stored in the env context and use these values in your workflow files. You can use the env context in any key within workflow steps, except for the id and uses keys.

If you want to use the value of a variable inside the execution environment, use the normal method of the execution environment's operating system to read environment variables.

Attribute NameTypeDescription
envobjectThis context is different for each step in a job. You can access this context from any step in the job. This object contains the attributes listed below.
env.<env_name>stringThe value of a specific environment variable.

Example Content of env Context​

The content of the env context is a mapping of variable names to their values. The content of the context may depend on where it is used within the workflow run. In this example, the env context contains two variables.

{

"first_name": "Mona",

"super_duper_var": "totally_awesome"

}

Example Usage of env Context​

This example workflow shows setting variables in the env context at the workflow, job, and step levels. The variable values are then retrieved in various steps throughout the workflow using the ${{ env.VARIABLE-NAME }} syntax.

When multiple environment variables with the same name are defined, AtomGit Pipeline uses the most specific variable. For example, environment variables defined at the step level will override job and workflow environment variables with the same name when that step executes. Environment variables defined for a job will override workflow variables with the same name when that job executes.

name: Hi Mascot
on:
push:
branches: main
env:
mascot: Mona
super_duper_var: totally_awesome

jobs:
windows_job:
runs-on: windows-latest
steps:
- name: Run echo Mona
run: echo 'Hi ${{ env.mascot }}' # Hi Mona
- name: Run echo Octocat
run: echo 'Hi ${{ env.mascot }}' # Hi Octocat
env:
mascot: Octocat
linux_job:
runs-on: ubuntu-latest
env:
mascot: Tux
steps:
- name: Run echo Tux
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 vars Context​

The content of the vars context is a mapping of configuration variable names to their values.

{
"mascot": "Mona"
}

Example Usage of vars Context​

This example workflow shows how configuration variables set at the repository, environment, or organization level are automatically available through the vars context.

[!NOTE] Environment-level configuration variables become automatically available once the execution environment declares its environment.

If a configuration variable has not been set, the return value of the context referencing that variable will be an empty string.

The following example demonstrates using configuration variables with the vars context throughout a workflow. Each configuration variable below has been defined at the repository, organization, or environment level.

on:
workflow_dispatch:
env:
# Set environment variable using configuration variable value
env_var: ${{ vars.ENV_CONTEXT_VAR }}

jobs:
display-variables:
name: ${{ vars.JOB_NAME }}
# You can use configuration variables with the `vars` context in dynamic jobs
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 }}

- name: ${{ vars.HELLO_WORLD_STEP }}
if: ${{ vars.HELLO_WORLD_ENABLED == 'true' }}
uses: actions/hello-world-javascript-action@main
with:
who-to-greet: ${{ vars.GREET_NAME }}

job Context​

The job context contains information about the currently running job.

Attribute NameTypeDescription
jobobjectThis context is different for each job in a workflow run. You can access this context from any step in the job. This object contains all attributes listed below.
job.containerobjectInformation about the job's container.
job.statusstringThe current status of the job. Possible values are success, failure, or cancelled.

Example Content of job Context​

This example job context uses a PostgreSQL service container with mapped ports. If no container or service containers are used in the job, the job context only contains the status and check_run_id attributes.

{
"status": "success"
}

jobs Context​

The jobs context is only available in reusable workflows and can only be used to set outputs for reusable workflows.

Attribute NameTypeDescription
jobsobjectThis is only available in reusable workflows and can only be used to set outputs for the reusable workflow. This object contains all attributes listed below.
jobs.<job_id>.resultstringThe result of the job in the reusable workflow. Possible values are success, failure, cancelled, or skipped.
jobs.<job_id>.outputsobjectThe collection of outputs from the job in the reusable workflow.
jobs.<job_id>.outputs.<output_name>stringThe value of a specific output from the job in the reusable workflow.

Example Content of jobs Context​

This example jobs context contains results and outputs from jobs in a reusable workflow run.

{
"example_job": {
"result": "success",
"outputs": {
"output1": "hello",
"output2": "world"
}
}
}

Example Usage of jobs Context​

This example reusable workflow uses the jobs context to set outputs for the reusable workflow. Notice how outputs flow from steps to the job, and then to the workflow_call trigger.

name: Reusable workflow

on:
workflow_call:
# Map workflow outputs to job outputs
outputs:
firstword:
description: "First output string"
value: ${{ jobs.example_job.outputs.output1 }}
secondword:
description: "Second output string"
value: ${{ jobs.example_job.outputs.output2 }}

jobs:
example_job:
name: Generate output
runs-on: ubuntu-latest
# Map job outputs to step outputs
outputs:
output1: ${{ steps.step1.outputs.firstword }}
output2: ${{ steps.step2.outputs.secondword }}
steps:
- name: Run step1
id: step1
run: echo "firstword=hello" >> $ATOMGIT_OUTPUT
- name: Run step2
id: step2
run: echo "secondword=world" >> $ATOMGIT_OUTPUT

steps Context​

The steps context contains information about steps that have specified and have already run in the current job.

Attribute NameTypeDescription
stepsobjectThis context is different for each step in a job. You can access this context from any step in the job. This object contains all attributes listed below.
steps.<step_id>.outputsobjectThe collection of outputs defined for the step.
steps.<step_id>.conclusionstringThe result of the step completed after applying . Possible values are success, failure, cancelled, or skipped. When a continue-on-error step fails, outcome is failure, but the final conclusion is success.
steps.<step_id>.outcomestringThe result of the step completed before applying . Possible values are success, failure, cancelled, or skipped. When a continue-on-error step fails, outcome is failure, but the final conclusion is success.
steps.<step_id>.outputs.<output_name>stringThe value of a specific output.

Example Content of steps Context​

This example steps context shows two previous steps, which have specified. The first step has an id named checkout, and the second is generate_number. The generate_number step has an output named random_number.

{
"checkout": {
"outputs": {},
"outcome": "success",
"conclusion": "success"
},
"generate_number": {
"outputs": {
"random_number": "1"
},
"outcome": "success",
"conclusion": "success"
}
}

Example Usage of steps Context​

This example workflow generates a random number as an output in one step, and subsequent steps use the steps context to read the value of that output.

name: Generate random failure
on:
push:
branches: main
jobs:
randomly-failing-job:
runs-on: ubuntu-latest
steps:
- name: Generate 0 or 1
id: generate_number
run: echo "random_number=$(($RANDOM % 2))" >> $ATOMGIT_OUTPUT
- name: Pass or fail
run: |
if [[ ${{ steps.generate_number.outputs.random_number }} == 0 ]]; then exit 0; else exit 1; fi

runner Context​

The runner context contains information about the runner executing the current job.

Attribute NameTypeDescription
runnerobjectThis context is different for each job in a workflow run. This object contains all attributes listed below.
runner.namestringThe name of the runner executing the job. This name may not be unique within the workflow run because runners at the repository and organization levels may use the same name.
runner.osstringThe operating system of the runner executing the job. Possible values are Linux, Windows, or macOS.
runner.archstringThe architecture of the runner executing the job. Possible values are X86, X64, ARM, or ARM64.
runner.tool_cachestringThe path to the directory on the AtomGit-hosted runner containing pre-installed tools.
runner.environmentstringThe environment of the runner executing the job. Possible values: codearts-hosted for AtomGit-provided managed runners, self-hosted for self-hosted runners configured by the repository owner.

Example Content of runner Context​

The following example context comes from a Linux AtomGit-managed runner.

{
"os": "Linux",
"arch": "X64",
"name": "Atomgit Actions 2",
"tool_cache": "/opt/hostedtoolcache",
"temp": "/home/runner/work/_temp"
}

Example Usage of runner Context​

This example workflow uses the runner context to set the path for a temporary directory written to the log, and uploads these logs as artifacts if the workflow fails.

name: Build
on:
push:
branches: main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Build with logs
run: |
mkdir ${{ runner.temp }}/build_logs
echo "Logs from building" > ${{ runner.temp }}/build_logs/build.logs
exit 1
- name: Upload logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: Build failure logs
path: ${{ runner.temp }}/build_logs

secrets Context​

The secrets context contains the names and values of secrets available to the workflow run. For security reasons, the secrets context is not suitable for composite actions. If you want to pass secrets to a composite action, you need to explicitly pass them as inputs.

ATOMGIT_TOKEN is a secret automatically created for each workflow run and is always included in the secrets context.

[!WARNING] If a secret is used in a workflow job, AtomGit Pipeline automatically masks secrets printed to the log. You should avoid intentionally printing secrets to the log.

Attribute NameTypeDescription
secretsobjectThis context is identical across all jobs in a workflow run. You can access this context from any step in the job. This object contains all attributes listed below.
secrets.ATOMGIT_TOKENstringThe token automatically created for each workflow run.
secrets.<secret_name>stringThe value of a specific secret.

Example Content of secrets Context​

The following example content of the secrets context shows the automatic ATOMGIT_TOKEN, along with two other secrets available to the workflow run.

{
"atomgit_token": "***",
"NPM_TOKEN": "***",
"SUPERSECRET": "***"
}

Example Usage of secrets Context​

This example workflow uses , which requires ATOMGIT_TOKEN as the value of the GH_TOKEN input parameter:

name: Open new issue
on: workflow_dispatch

jobs:
open-issue:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Run sh
run: |
gh issue --repo ${{ atomgit.repository }} \
create --title "Issue title" --body "Issue body"
env:
GH_TOKEN: ${{ secrets.ATOMGIT_TOKEN }}

strategy Context​

For workflows with matrices, the strategy context contains information about the matrix execution strategy for the current job.

Attribute NameTypeDescription
strategyobjectThis context is different for each job in a workflow run. You can access this context from any job or step in the workflow. This object contains all attributes listed below.
strategy.fail-fastbooleanWhen this evaluates to true, if any job in the matrix fails, all ongoing jobs will be cancelled.
strategy.job-indexnumberThe index of the current job in the matrix. Note: This number is zero-indexed. The index of the first job in the matrix is 0.
strategy.job-totalnumberThe total number of jobs in the matrix. Note: This number is not zero-indexed. For example, for a matrix with four jobs, the value of job-total is 4.
strategy.max-parallelnumberThe maximum number of jobs that can run simultaneously when using the matrix job strategy.

Example Content of strategy Context​

The following example content of the strategy context comes from a matrix with four jobs and is taken from the last job. Notice the difference between the zero-indexed job-index numbering and the non-zero-indexed job-total.

{
"fail-fast": true,
"job-index": 3,
"job-total": 4,
"max-parallel": 4
}

Example Usage of strategy Context​

This example workflow uses the strategy.job-index attribute to set a unique name for the log file for each job in the matrix.

name: Test strategy
on:
push:
branches: main

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
test-group: [1, 2]
node: [14, 16]
steps:
- name: Run echo
run: echo "Mock test logs" > test-job-${{ strategy.job-index }}.txt
- name: Upload logs
uses: actions/upload-artifact@v4
with:
name: Build log for job ${{ strategy.job-index }}
path: test-job-${{ strategy.job-index }}.txt

matrix Context​

For workflows with matrices, the matrix context contains attributes related to the matrix defined in the workflow file that apply to the current job. For example, if you configure a matrix with os and node keys, the matrix context object includes os and node attributes along with the values being used by the current job.

There are no standard attributes in the matrix context, only those defined in the workflow file.

Attribute NameTypeDescription
matrixobjectThis context only applies to jobs in the matrix and is different for each job in a workflow run. You can access this context from any job or step in the workflow. This object contains the attributes listed below.
matrix.<property_name>stringThe value of a matrix attribute.

Example Content of matrix Context​

The following example content of the matrix context comes from a job in a matrix with os and node attributes defined in the workflow. This job is executing a matrix combination of ubuntu-latest OS and Node.js version 16.

{
"os": "ubuntu-latest",
"node": 16
}

Example Usage of matrix Context​

This example workflow uses a matrix with os and node keys. It uses the matrix.os attribute to set the execution environment type for each job and the matrix.node attribute to set the Node.js version for each job.

name: Test matrix
on:
push:
branches: main

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu os:-latest, windows-latest]
node: [14, 16]
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Output node version
run: node --version

inputs Context​

The inputs context contains input properties passed to actions, reusable workflows, or manually triggered workflows. For reusable workflows, input names and types are defined in the workflow_call event of the reusable workflow, and input values are passed from the calling workflow's jobs.<job_id>.with in the outer workflow. For manually triggered workflows, inputs are defined in the workflow's workflow_dispatch.

Attributes in the inputs context are defined in the workflow file. They are only available in reusable workflows workflow_call or workflows triggered by workflow_dispatch.

Attribute NameTypeDescription
inputsobjectThis context is only available in reusable workflows or workflows triggered by the workflow_dispatch event. You can access this context from any job or step in the workflow. This object contains the attributes listed below.
inputs.<name>string or number or boolean or choiceEach input value passed from the outer workflow.

Example Content of inputs Context​

The following example content of the inputs context comes from a workflow that defines build_id, deploy_target, and perform_deploy inputs.

{
"build_id": 123456768,
"deploy_target": "deployment_sys_1a",
"perform_deploy": true
}

Example Usage of inputs Context in Reusable Workflows​

This example reusable workflow uses the inputs context to retrieve the values of build_id, deploy_target, and perform_deploy inputs passed from the caller workflow to the reusable workflow.

name: Reusable deploy workflow
on:
workflow_call:
inputs:
build_id:
required: true
type: number
deploy_target:
required: true
type: string
perform_deploy:
required: true
type: boolean

jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ inputs.perform_deploy }}
steps:
- name: Deploy build to target
run: echo "Deploying build:${{ inputs.build_id }} to target:${{ inputs.deploy_target }}"

Example Usage of inputs Context in Manually Triggered Workflows​

This example workflow triggered by the workflow_dispatch event uses the inputs context to retrieve the values of build_id, deploy_target, and perform_deploy inputs passed to the workflow.

on:
workflow_dispatch:
inputs:
build_id:
required: true
type: string
deploy_target:
required: true
type: string
perform_deploy:
required: true
type: boolean

jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ inputs.perform_deploy }}
steps:
- name: Deploy build to target
run: echo "Deploying build:${{ inputs.build_id }} to target:${{ inputs.deploy_target }}"

Context Lifecycle Management​

In AtomGit Actions, contexts are not loaded all at once when a workflow is triggered. Workflow execution follows a strict step-by-step evaluation mechanism. Contexts are only resolved and injected into the execution environment when the pipeline orchestration and scheduling engine transitions to specific lifecycle stages. Referencing a context that hasn't been injected yet in the wrong stage will result in empty variables or syntax evaluation errors.

Workflow context injection timing is divided into four core stages: Parsing, Scheduling & Assignment, Execution, and Archival.

Context Injection Timing​

Lifecycle StageInjection/Evaluation Timing DescriptionInjected ContextsData Content & Technical Definition
1. Parse Phase1. Engine receives Webhook or manual trigger events, initially parses and validates the YAML structure. 2. Builds job dependency topology graph (DAG) and expands concurrency matrices.ATOMGIT inputs vars matrix strategyGlobal baselines and input data • ATOMGIT: Repository metadata, trigger event payloads (Payload), commit hashes, etc. • inputs: Parameters passed in during user manual triggers or upstream calls. • vars: Pre-set plaintext variables at organization/repository/environment levels. Job orchestration and topology data • needs: Status and output artifacts from prerequisite dependent jobs (needs: xxx) after completion. • matrix: Specific matrix dimension parameters for the current job instance when expanding concurrent matrices. • strategy: Scheduling strategy configuration for the current job (e.g., concurrency limits, failure policies).
2. Scheduling & Assignment PhaseJobs pass condition evaluations and are successfully assigned to specific physical Runner nodes or containers.runner secretsRuntime environments and sensitive data • runner: Hardware and system environment of the target machine (e.g., OS, architecture, temp directories). • secrets: Encrypted credentials. Decrypted and injected only after secure assignment to nodes; reading in job-level if is strictly prohibited.
3. Execution PhaseRunners receive complete instructions and begin sequentially executing specific step (steps) code.env job stepsRuntime dynamic state data • env: Environment variables, dynamically overridden by hierarchy Workflow -> Job -> Step as execution reaches that node. • job: Real-time execution status of the current job (e.g., success, cancelled). • steps: Output results (outputs) and termination states of steps that have finished execution within the current job.
4. Archival Phase(Special Scenario) All jobs in a reusable workflow have finished execution and need to return results to the upstream caller.jobsReusable workflow output mapping • jobs: Limited to use in reusable workflows triggered by workflow_call. Used to evaluate in the outputs block at the workflow root, extracting and exposing outputs from specific internal jobs to upstream callers.

Context Availability​

When writing YAML, the engine enforces strict whitelist restrictions on which contexts are allowed to be read for different configuration fields. Forcing a reference to a context not on the whitelist at a specific node will cause the parser to evaluate it as empty.

Below are the contextual availabilities for different scenarios:

Contextjobs.<job_id>.if (Job Execution Condition)jobs.<job_id>.outputs (Job-level Outputs)steps.if (Step Execution Condition)run Script (Shell Execution Environment)on.workflow_call.outputs (Reusable Workflow Final Outputs)
ATOMGIT✅ Available✅ Available✅ Available✅ Available✅ Available
inputs✅ Available✅ Available✅ Available✅ Available✅ Available
vars✅ Available✅ Available✅ Available✅ Available❌ Unavailable
needs✅ Available✅ Available✅ Available✅ Available❌ Unavailable
matrix❌ Unavailable✅ Available✅ Available✅ Available❌ Unavailable
strategy❌ Unavailable✅ Available✅ Available✅ Available❌ Unavailable
runner❌ Unavailable✅ Available✅ Available✅ Available❌ Unavailable
secrets❌ Unavailable✅ Available✅ Available✅ Available❌ Unavailable
env❌ Unavailable✅ Available✅ Available✅ Available❌ Unavailable
job❌ Unavailable✅ Available✅ Available✅ Available❌ Unavailable
steps❌ Unavailable✅ Available✅ Available✅ Available❌ Unavailable
jobs❌ Unavailable❌ Unavailable❌ Unavailable❌ Unavailable✅ Only Usable Here