admin管理员组文章数量:1379913
How do I write something like this? At the moment using a colon seems to break everything. Is there an equivalent?
run-name: Something Running ${{ (inputs.cache-retain == 'true') ? '(with forced cache-retain)' : ''}}
e.g.
- if true:
'Something running (with forced cache-retain)'
- if false:
'Something running'
is what I'm looking for.
How do I write something like this? At the moment using a colon seems to break everything. Is there an equivalent?
run-name: Something Running ${{ (inputs.cache-retain == 'true') ? '(with forced cache-retain)' : ''}}
e.g.
- if true:
'Something running (with forced cache-retain)'
- if false:
'Something running'
is what I'm looking for.
Share Improve this question edited Mar 28 at 14:59 dankoiDev asked Mar 28 at 14:41 dankoiDevdankoiDev 1336 bronze badges 1 |1 Answer
Reset to default 1Github Actions doesn't support ternary expressions. But using this workaround should work:
${{ x && 'ifTrue' || 'ifFalse' }}
run: Something Running ${{ inputs.cache-retain == true && "(with forced cache retain)" || "" }}
本文标签: yamlWhat is the ternary operator equivalent in GitHub ActionsStack Overflow
版权声明:本文标题:yaml - What is the ternary operator equivalent in GitHub Actions? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744030574a2578830.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
${{ }}
you're writing a GitHub Actions expression. – jonrsharpe Commented Mar 28 at 14:54