Skip to content

Multi line if then else in actions expressions

ChristopherHX edited this page Nov 12, 2022 · 1 revision
environment: |-
  ${{
     github.ref_name == 'master' && 'production'
  || github.ref_name == 'dev'    && 'dev'
  ||                                'staging'
  }}

Only the last case can be one of null, '', false or 0 otherwise the following non falsy value will be the result in the expression. |- tells the yaml parser to not append a newline token to the expression result.