Interview Prep/GitHub Actions/Jobs, Steps, Matrix & Concurrency

Why does `if: !startsWith(github.ref, 'refs/tags/')` break the workflow file?

IntermediateConceptJobs, Steps, Matrix & Concurrency
Answer

In YAML, a value starting with ! is a tag indicator, so the parser fails or misreads it. Wrap it:

if: ${{ !startsWith(github.ref, 'refs/tags/') }}

or quote it: if: "!startsWith(github.ref, 'refs/tags/')". Same issue for values starting with * or &.

All GitHub Actions questions Roadmap: GitHub Actions

More on Jobs, Steps, Matrix & Concurrency