Variables, Secrets, Contexts, and Expressions
This document introduces the four-level variable system of AtomGit Action, 12 contexts, and expression syntax, helping to use dynamic values and conditional judgments in workflows.
Four-Level Variable System
| Type | Suitable for storing | Sensitive | Reference method |
|---|---|---|---|
env | Workflow internal temporary variables | No | $VAR_NAME or ${{ env.VAR }} |
vars | Repository/organization level common variables | No | ${{ vars.VAR }} |
secrets | Passwords, tokens, private keys | Yes | ${{ secrets.NAME }} |
inputs | Workflow input parameters | No | ${{ inputs.NAME }} |
Variable Priority
Step env > Job env > Workflow env
Contexts
AtomGit Action supports 12 contexts, with the core context name atomgit:
| Context | Description | Typical attributes |
|---|---|---|
atomgit | Core information of workflow run | atomgit.sha, atomgit.ref, atomgit.event_name |
env | Environment variables | env.VAR_NAME |
vars | Configuration variables | vars.VAR_NAME |
secrets | Secrets | secrets.NAME |
job | Current job information | job.status |
steps | Step information and outputs | steps.id.outputs.result |
runner | Runner information | runner.os, runner.arch |
inputs | Input parameters | inputs.NAME |
matrix | Matrix parameters | matrix.os |
strategy | Matrix strategy information | strategy.fail-fast |
Expressions
Expressions are embedded into YAML values using the ${{ expression }} syntax:
Operators: ==, !=, !, &&, ||
Status Functions:
| Function | Description |
|---|---|
always | Always execute regardless of success or failure |
String Functions: contains, startsWith, endsWith, format, substring, replace