Created
September 20, 2024 09:27
-
-
Save floitsch/dda38d46dcb3e1471706196c37611fe1 to your computer and use it in GitHub Desktop.
Correct usage of boolean flags in GitHub actions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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