A step should run only when the workflow is triggered from a branch whose ref name contains 'hotfix/'. Which expression is correct?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Use the contains() expression function on github.ref_name (or github.ref) to test substring membership. Regex operators like ~= are not part of the expression language.
Full explanation below image
Full Explanation
GitHub Actions expressions provide functions such as contains(), startsWith(), endsWith(), and format(). There is no Perl-style ~= operator and no Jinja-style pipe filters. github.ref_name is the short branch or tag name; github.ref is the full refs/heads/... form. For prefix checks prefer startsWith(github.ref_name, 'hotfix/'). For complex patterns, compute a step output or use multiple conditions. Avoid inventing match() unless you implement custom logic outside expressions.