Inputs.required not enforced with no default?

Hi, I’m following the GitHub Actions: Writing JavaScript Actions course and I have a question regarding the inputs.required parameter.

I updated my action.yml file so that an input is required but no default is provided:

    description: "who would you like to greet in the console"
    required: true

In the workflow, I don’t provide the input either:

      - name: hello-action
        uses: ./.github/actions/hello-world

Observed results: the action is successfully ran:

Run ./.github/actions/hello-world
Hello Mona the Octocat

Expected results: an error is raised.

Here is the repo+commit corresponding: writing-javascript-actions/.github/workflows at 0dcc416d922c1572124153b9b949fec172b59aaf · gjadi-mej/writing-javascript-actions · GitHub
Here is the action log (sorry only 2 links allowed for a first post): gjadi-mej/writing-javascript-actions/actions/runs/1345241384

Here is the documentation (source):

Required A boolean to indicate whether the action requires the input parameter. Set to true when the parameter is required.

The doc doesn’t say anything about raising an error but, to me, that’s the meaning of the world required.
I haven’t yet dig further into the javascript lib, and I imagine it’s possible to detect the empty input toraise an error from the main.js but that seems redundant with the required keyword.

Did I miss something?
Thanks for the answers.


1 Like

I had a quick look through actions/runner and can’t see anything that implements the “required” functionality for action inputs.

For inputs that aren’t specified in the workflow the default is used if set, otherwise an empty string is used. There’s no check that a value was specified in the workflow for “required” inputs

1 Like

Ok, thanks for checking this out.
I will open an issue on the repository.


This issue looks to be for the same problem you described: Validate required inputs are set before invoking an action · Issue #1070 · actions/runner · GitHub