Skip to content

If (not) startswith mutually exclusive steps #26386

Discussion options

You must be logged in to vote

@valentijnscholten,

You are using the incorrect expression syntax for the if conditional in your workflow.
Change them like as this can work:

- name: Create release branch
  if: ${{ !startsWith(github.event.inputs.from_branch, 'release/') }}
  run: |
    echo "NEW_BRANCH=release/${{ github.event.inputs.release_number }}" >> $GITHUB_ENV
  • name: Use existing release branch
    if: ${{ startsWith(github.event.inputs.from_branch, 'release/') }}
    run: |
    echo "NEW_BRANCH=${{ github.event.inputs.from_branch }}" >> $GITHUB_ENV

There are few points you need to know when setting if conditionals (jobs.<job_id>.if or jobs.<job_id>.steps.if) in your workflow:

  1. If you want to use the expression syntax “${{ }}

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants