Skip to content

core.getInput does not tell the caller if the returned value is defined in the yaml or not #272

@lukka

Description

@lukka

Describe the enhancement
core.getInput() should allow the caller to understand whether the value is explicitly set in the yaml file, or whether it is not.
Right now you get an empty string, either when it is not defined, either when the user defined it as an empty string.

Code Snippet

this would allow this code:

const inputValue = core.getInput(inputName) ?? defaultValue;

Right now you have to use this instead:

const inputValue = core.getInput(inputName) || defaultValue;

which is not the same.

Use case
e.g. An action's input is a string which is a list of flags, if the default is "-v" and the user wants to have no flags at all (e.g. flags: ""), having this explicitly stated as input (e.g. flags: "") would be always (uncorrectly) replaced by the default (when using ||). To overcome this the user is forced to define a in the yaml the input as blank space instead (e.g. flags: " ")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions