Skip to content

Instantly share code, notes, and snippets.

@floitsch
Created September 20, 2024 09:27
Show Gist options
  • Select an option

  • Save floitsch/dda38d46dcb3e1471706196c37611fe1 to your computer and use it in GitHub Desktop.

Select an option

Save floitsch/dda38d46dcb3e1471706196c37611fe1 to your computer and use it in GitHub Desktop.
Correct usage of boolean flags in GitHub actions
# Use 'inputs.<name>' when pasting into a bash `if`, like so:
# if [[ "${{ inputs.strip }}" == 'true' ]]; then ...
#
# When using to guard a step, use 'github.event.inputs.<name>', like so:
# if: ${{ github.event.inputs.<name> == 'true' }}
# or
# if: ${{ github.event.inputs.<name> != 'false' }}
# In the first case, the step will not run if there isn't any workflow dispatch.
# In the second case, the step will run if there isn't any workflow dispatch.
# As such, the recommendation is to use the `== true` if the default is
# false, and the `!= false` if the default is true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment