Do not give workflow boolean inputs default values - #3014
Conversation
| - uses: ./.github/actions/build-docs | ||
|
|
||
| deploy_documentation: | ||
| if: ${{ github.event_name == 'push' || inputs.publish }} |
There was a problem hiding this comment.
I'm not sure about removing that: github.event_name == 'push'
I added it because these steps weren't getting triggered because the inputs were not defined when it's a push (vs when it's a manual trigger).
There was a problem hiding this comment.
If it's not defined will !inputs.dry_run evaluate to true?
There was a problem hiding this comment.
Yes for pushes the !inputs.dry_run would evaluate to true so it defaults to publish run, unlike previous condition inputs.publish which defaults to dry run.
I did a push-triggered run to verify it:
https://github.com/ml-explore/mlx/actions/runs/21111546178
(it ran the deploy_documentation job, unlike the dry run that did not.)
It is still possible that another pitfall would cause the push-triggered publish to fail, but when that happens I think we can just do a manually-triggered publish and fix it later.
There is a pitfall in GitHub Actions that the default value of workflow_dispatch inputs can only be string, so when setting
default: truewe might get a string "true" or a boolean false as default value (it seems that we ran into the latter case).This PR just removes the default values so inputs would all default to boolean
falsefor pushes.Also note that I'm using a non-exist env in
name: ${{ inputs.dry_run && 'dry-run' || 'pypi' }}becauseinputs.dry_run && '' || 'pypi'would always evaluate topypiregardless of the input value, which is another pitfall.Checked a few cases and they all seem to work as expected: