Ask Your Question
0

What is the method to retrieve the inputs of the composite GitHub action within the script files that are invoked by the composite action?

asked 2022-12-11 11:00:00 +0000

nofretete gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-10-04 05:00:00 +0000

qstack gravatar image

To retrieve the inputs of the composite GitHub action within the script files that are invoked by the composite action, you can use the inputs object provided by the GitHub Actions context. The inputs object contains the value of all declared inputs for the action.

You can access the inputs object in your script file by referencing the environment variable INPUT_<INPUT_NAME> (where <INPUT_NAME> is the name of the input). For example, to retrieve the value of an input named my-input in a JavaScript script file, you can use the following code:

const myInput = process.env.INPUT_MY_INPUT;
console.log(`The value of my input is: ${myInput}`);

Note that the INPUT_<INPUT_NAME> environment variable may contain a string value, so you may need to parse it or convert it to the appropriate data type.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-12-11 11:00:00 +0000

Seen: 10 times

Last updated: Oct 04 '22