In a JavaScript action, which @actions/core API reads an input defined in action.yml as 'api-key'?
Select an answer to reveal the explanation.
Short Explanation and Infographic
core.getInput('api-key') is the standard toolkit method. Inputs are also exposed as INPUT_* style env vars, but the supported API is getInput (and getBooleanInput for booleans).
Full explanation below image
Full Explanation
The @actions/core package provides getInput(name, options) to read inputs declared under inputs in action.yml. For api-key, call core.getInput('api-key'). Optional options include required: true. getBooleanInput handles boolean inputs. There is no core.readSecret for action inputs — secrets passed as inputs are still read via getInput, and you should avoid logging them. core.inputs.apiKey() is not an API. While the runner exposes inputs as environment variables with an INPUT_ prefix, relying on process.env.api-key is incorrect (wrong name form) and bypassing getInput is discouraged. Use core.setOutput, core.setFailed, and core.exportVariable for other common tasks when authoring JavaScript actions.