In a JavaScript action using @actions/core, which function marks the action as failed?
Select an answer to reveal the explanation.
Short Explanation and Infographic
core.setFailed() is the proper way to fail a JavaScript action — it sets the exit code AND logs the error message through the Actions toolkit.
Full explanation below image
Full Explanation
In JavaScript actions using the @actions/core package, 'core.setFailed(message)' is the recommended way to fail an action. It sets the error message and the process exit code to 1 (failure). Using 'process.exit(1)' would terminate the process but without the toolkit's error formatting or cleanup handlers. Using 'core.exit(1)' doesn't exist in @actions/core. Throwing an uncaught Error will cause the action to fail but may produce less clean error output. 'core.setFailed()' also continues running any registered cleanup handlers. The @actions/core module also provides: core.info(), core.warning(), core.error(), core.debug() for logging.