Skip to content

Do expressions support ternary operators to change their returned value? #26738

Answered by Yanjingzhu
atrauzzi asked this question in Actions
Discussion options

You must be logged in to vote

Hi @atrauzzi , 

Expressions don’t support ternary operators. You could create a feedback for this feature in the Feedback form for GitHub Actions .

As a workaround , you could add another step to set prerelease as true or false before Create Release step. In my example , I use set-output command to set an output variable in the front step, then use it in Create Release step .

- name: prerelease or not
  id: pre_or_not
  run: |
    if [$REF == 'refs/heads/master']
    then
        echo "::set-output name=prerelease::true"
    else
        echo "::set-output name=prerelease::false"
    fi
  env:
    REF: ${{ github.ref }}
  • name: Create Release
    id: create-release
    uses: actions/create-release@v1

Replies: 5 comments 5 replies

Comment options

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

@akostadinov
Comment options

Answer selected
Comment options

You must be logged in to vote
1 reply
@nemanjaglumac
Comment options

Comment options

You must be logged in to vote
1 reply
@kbolino
Comment options

Comment options

You must be logged in to vote
1 reply
@samuliasmala
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment