Interview Prep/GitHub Actions/Contexts, Expressions, Env & Outputs

Which contexts can you use in which keys? Give two examples that trip people up.

AdvancedConceptContexts, Expressions, Env & Outputs
Answer

Availability is per key, documented in the "context availability" table. Two common traps:

  • jobs.<id>.runs-on can use github, needs, strategy, matrix, vars, inputs, but not env or secrets.
  • jobs.<id>.if cannot use env, steps or runner, and no if can reference secrets directly (Unrecognized named-value: 'secrets'). Map the secret into env at job level and test env.X != '' at step level.

concurrency at workflow level cannot use env, matrix or needs either.

All GitHub Actions questions Roadmap: GitHub Actions

More on Contexts, Expressions, Env & Outputs