Search code examples
github-actionsgithub-cli

`github workflow run` forcing me to give a value for non-required value


I have a GitHub action that is only run manually for creating a build and publishing it either to PyPI or to Test PyPI (or both)

on:
  workflow_dispatch:
    inputs:
      pypi:
        description: 'Release to PyPI'
        required: false
        default: false
        type: boolean

      test_pypi:
        description: 'Release to Test PyPI'
        required: false
        default: true
        type: boolean

When I attempt to start this workflow using the CLI:

$ gh workflow run publish-to-pypi.yml --ref master
could not create workflow dispatch event: HTTP 422: Provided value '' for input 'pypi' not in the list of allowed values ...

When I include a value of pypi, everything works okay:

$ gh workflow run publish-to-pypi.yml --ref master -f pypi=false

It seems strange that I need to give a value for pypi, but not for test_pypi, even though both are required: false.

What am I missing?


Solution

  • Looks like it is still open bug on github platform GitHub Issues

    The workaround is to always supply values even for optional Boolean fields.