- run: echo "User: ${{ github.actor }}" # github
- run: echo "Env: ${{ env.ENVIRONMENT }}" # env
- run: echo "Secret: ${{ secrets.API_KEY }}" # secrets
- run: echo "Runner OS: ${{ runner.os }}" # runner
- run: echo "Job Status: ${{ job.status }}" # job
- run: echo "Step Output: ${{ steps.build.outputs.version }}" # steps
- run: echo "Matrix: ${{ matrix.node_version }}" # matrix
- run: echo "Input: ${{ inputs.target_env }}" # inputs
- run: echo "Var: ${{ vars.REGION }}" # vars
- run: echo "Total matrix jobs: ${{ strategy.job-total }}" # strategy
- run: echo "Output from build job: ${{ needs.build.outputs.url }}" # needs
Context | Description | Common Fields | Example Usage |
github | Metadata about the workflow, repo, event, actor, commit, etc. | actor, event_name, ref, sha, repository, workflow, event, run_id | ${{ github.actor }}, ${{ github.ref }} |
env | Environment variables set at workflow/job/step level | Any custom env var | ${{ env.MY_ENV_VAR }} |
secrets | Encrypted secrets stored in GitHub UI | Your secret names (e.g. AWS_SECRET_KEY) | ${{ secrets.MY_SECRET }} |
runner | Information about the runner GitHub is using | os, arch, name, temp, tool_cache, workspace | ${{ runner.os }}, ${{ runner.name }} |
job | Info about the current job | status | ${{ job.status }} |
steps | Access to outputs and status of previous steps in a job | steps.<step_id>.outputs.<name>, steps.<step_id>.conclusion | ${{ steps.build.outputs.version }} |
matrix | Matrix values for jobs running with strategy.matrix | Your defined matrix keys | ${{ matrix.node }}, ${{ matrix.os }} |
inputs | Inputs provided via workflow_dispatch trigger | Your input names defined in YAML | ${{ inputs.environment }} |
vars | GitHub-defined or user-defined variables (repo/org level) | Your defined variable names | ${{ vars.REGION }} |
strategy | Info about the matrix strategy being used | job-total, fail-fast | ${{ strategy.job-total }} |
needs | Access to outputs from a job dependency | needs.<job_id>.outputs.<name> | ${{ needs.build.outputs.artifact_url }} |
No comments:
Post a Comment