Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getInput replaces only first occurrence of a space character #127

Closed
manusa opened this issue Sep 11, 2019 · 3 comments
Closed

getInput replaces only first occurrence of a space character #127

manusa opened this issue Sep 11, 2019 · 3 comments
Assignees

Comments

@manusa
Copy link
Contributor

manusa commented Sep 11, 2019

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()}`] || ''
@damccorm damccorm self-assigned this Sep 12, 2019
damccorm pushed a commit that referenced this issue Sep 12, 2019
* #127: getInput supports variables with multiple spaces

* #127: PR comment, update changelog
@bryanmacfarlane
Copy link
Member

bryanmacfarlane commented Sep 17, 2019

Fixed will be in next release which should go out in the next day or two

@manusa
Copy link
Contributor Author

manusa commented Sep 24, 2019

I confirm it's fixed and available in v1.1.1

@bryanmacfarlane
Copy link
Member

Thanks!

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

No branches or pull requests

3 participants