跳到主要内容

Variables, Secrets, Contexts, and Expressions

AtomGit Action provides a four-level variable system: env, vars, secrets, and inputs, achieving flexible workflow configuration through contexts (core is atomgit) and expressions (${{ expression }}).

Four-Level Variable System

TypeSuitable for storingSensitiveReference method
envTemporary variables within the workflowNo$VAR_NAME or ${{ env.VAR }}
varsGeneral variables at repository/organization levelNo${{ vars.VAR }}
secretsPasswords, tokens, private keysYes${{ secrets.NAME }}
inputsWorkflow input parametersNo${{ inputs.NAME }}

Variable Priority

Step env > Job env > Workflow env

Contexts

AtomGit Action supports 12 contexts, with the core context named atomgit:

ContextDescriptionTypical Properties
atomgitCore information of the workflow runatomgit.sha, atomgit.ref, atomgit.event_name
envEnvironment variablesenv.VAR_NAME
varsConfiguration variablesvars.VAR_NAME
secretsSecretssecrets.NAME
jobCurrent job informationjob.status
stepsStep information and outputssteps.id.outputs.result
runnerRunner informationrunner.os, runner.arch
inputsInput parametersinputs.NAME
matrixMatrix parametersmatrix.os
strategyMatrix strategy informationstrategy.fail-fast

Expressions

Expressions are embedded in YAML values using the ${{ expression }} syntax:

Operators: ==, !=, !, &&, ||

Status Functions:

FunctionDescription
successPrevious steps succeeded
alwaysExecute regardless of success or failure
cancelledWorkflow was cancelled
failedPrevious steps failed

String Functions: contains, startsWith, endsWith, format, substring, replace

Special Functions: hashFiles, toJson