Skip to content
Discussion options

You must be logged in to vote

What you're doing is clever and technically works today, but GitHub doesn't officially document or guarantee support for inline conditional logic inside ${{ }} expressions the way you’ve used it (like && and ||).

A few notes:

GitHub Actions expression syntax does support ternary logic, but it's safer to use the documented form:

${{ condition && 'value-if-true' || 'value-if-false' }} However, edge cases can break if the "true" value is falsey (like an empty string), which might cause the "false" value to get used instead.

GitHub might change how it handles expressions or validation in the future — so relying on undocumented patterns does carry risk.

Safer alternatives:
Use if: conditions a…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jackwilliamsinfra
Comment options

@vishankmishra
Comment options

Answer selected by jackwilliamsinfra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question Ask and answer questions about GitHub features and usage Misc General discussions about GitHub Actions that don't fit other found themes.
2 participants