Skip to content

getInput replaces only first occurrence of a space character #127

Description

@manusa

getInput function in @actions/core package only replaces the first occurrence of a "space" character.

e.g. 'require some value' will be transformed to 'INPUT_REQUIRE_SOME VALUE' which is wrong.

export function getInput(name: string, options?: InputOptions): string {
const val: string =
process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || ''
if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`)
}
/* ... */

Following line

process.env[`INPUT_${name.replace(' ','_').toUpperCase()}`]||''
should probably be replaced by:

process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions