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

What do `contains`, `startsWith`, `endsWith`, `format` and `join` do?

BeginnerConceptContexts, Expressions, Env & Outputs
Answer
if: contains(github.event.pull_request.labels.*.name, 'deploy-preview')
if: startsWith(github.ref, 'refs/tags/v')
if: endsWith(github.repository, '-infra')
run: echo "${{ format('{0}/{1}:{2}', vars.REGISTRY, 'api', github.sha) }}"
run: echo "Targets ${{ join(matrix.targets, ', ') }}"

contains works on strings (substring, case-insensitive) and arrays (element match). format uses {0} placeholders and {{ to escape braces.

All GitHub Actions questions Roadmap: GitHub Actions

More on Contexts, Expressions, Env & Outputs