According to GitHub Actions syntax rules, which form is valid for a step-level if condition?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Expressions use ${{ }}. On if: specifically you can also omit the braces, but double curly without dollar, shell $(), and Jinja {% %} are all invalid in workflow YAML.
Full explanation below image
Full Explanation
GitHub Actions expressions are delimited by ${{ and }}. For if: fields, GitHub also allows writing the expression without the surrounding ${{ }} because if: is always treated as an expression. Both if: ${{ github.ref == 'refs/heads/main' }} and if: github.ref == 'refs/heads/main' are accepted. {{ }} without the dollar sign is not Actions syntax (it resembles some template engines). $(...) is shell command substitution, not an Actions expression. {% %} is Jinja/Liquid-style and is not used in workflow YAML. When embedding expressions inside strings for run: or with: values, you generally need ${{ }} so the engine interpolates them into the string correctly.