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

Accept non-process arguments in functions for easier testing #1904

Open
jghiloni opened this issue Dec 13, 2024 · 0 comments
Open

Accept non-process arguments in functions for easier testing #1904

jghiloni opened this issue Dec 13, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jghiloni
Copy link

jghiloni commented Dec 13, 2024

Describe the enhancement
Maybe I missed something completely, but it'd be great for functions like core.getInput or core.setOutput to take a NodeJS.ProcessEnv object as an optional argument, defaulting to process.env, to make testing JS actions easier and cleaner.

Code Snippet
If your action code is something like

import * as core from "@actions/core";

const myInput = core.getInput("my_input_var"); 

it could be something like

import * as core from "@actions/core";

const myInput = core.getInput("my_input_var", undefined /* options */, {
  INPUT_MY_INPUT_VAR: "some-value",
});

Additional information
Again, if that's already possible, sorry for the extra toil!

@jghiloni jghiloni added the enhancement New feature or request label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant