Restore failure semantics

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Parker Brown
2026-03-20 22:43:14 -07:00
parent c28e731c85
commit 7b2a5fbdc3
4 changed files with 28 additions and 11 deletions
+1 -3
View File
@@ -23375,9 +23375,7 @@ async function run() {
}
var main_default = run().catch((error2) => {
console.error(error2);
if (process.env.GITHUB_OUTPUT !== void 0) {
setFailed(error2.message);
}
setFailed(error2.message);
});
/*! Bundled license information:
+2 -5
View File
@@ -48,10 +48,7 @@ async function run() {
// Export promise for testing
export default run().catch((error) => {
/* c8 ignore next 5 */
/* c8 ignore next 3 */
console.error(error);
// Don't set failed in test mode (when GITHUB_OUTPUT is undefined)
if (process.env.GITHUB_OUTPUT !== undefined) {
core.setFailed(error.message);
}
core.setFailed(error.message);
});
+12 -3
View File
@@ -46,9 +46,18 @@ for (const file of testFiles) {
NODE_USE_ENV_PROXY,
...env
} = process.env;
const { stderr, stdout } = await execFileAsync("node", [`tests/${file}`], {
env,
});
let stderr, stdout;
try {
({ stderr, stdout } = await execFileAsync("node", [`tests/${file}`], {
env,
}));
} catch (error) {
if (!(error instanceof Error) || !("stderr" in error) || !("stdout" in error)) {
throw error;
}
({ stderr, stdout } = error);
}
const trimmedStderr = normalizeStderr(stderr).replace(/\r?\n$/, "");
const trimmedStdout = stdout.replace(/\r?\n$/, "");
await t.test("stderr", (t) => {
+13
View File
@@ -30,6 +30,7 @@ Error: No enterprise installation found matching the name test-enterprise.
exports[`main-enterprise-installation-not-found.test.js > stdout 1`] = `
Creating enterprise installation token for enterprise "test-enterprise".
Failed to create token for enterprise "test-enterprise" (attempt 1): No enterprise installation found matching the name test-enterprise.
::error::No enterprise installation found matching the name test-enterprise.
--- REQUESTS ---
GET /enterprises/test-enterprise/installation
`;
@@ -44,6 +45,10 @@ Error: Cannot use 'enterprise' input with 'owner' or 'repositories' inputs
at async file://<cwd>/tests/main-enterprise-mutual-exclusivity-owner.test.js:<line>:<column>
`;
exports[`main-enterprise-mutual-exclusivity-owner.test.js > stdout 1`] = `
::error::Cannot use 'enterprise' input with 'owner' or 'repositories' inputs
`;
exports[`main-enterprise-mutual-exclusivity-repositories.test.js > stderr 1`] = `
Error: Cannot use 'enterprise' input with 'owner' or 'repositories' inputs
at main (file://<cwd>/lib/main.js:<line>:<column>)
@@ -54,6 +59,10 @@ Error: Cannot use 'enterprise' input with 'owner' or 'repositories' inputs
at async file://<cwd>/tests/main-enterprise-mutual-exclusivity-repositories.test.js:<line>:<column>
`;
exports[`main-enterprise-mutual-exclusivity-repositories.test.js > stdout 1`] = `
::error::Cannot use 'enterprise' input with 'owner' or 'repositories' inputs
`;
exports[`main-enterprise-only-success.test.js > stdout 1`] = `
Creating enterprise installation token for enterprise "test-enterprise".
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a
@@ -117,6 +126,10 @@ exports[`main-proxy-requires-native-support.test.js > stderr 1`] = `
A proxy environment variable is set, but Node.js native proxy support is not enabled. Set NODE_USE_ENV_PROXY=1 for this action step.
`;
exports[`main-proxy-requires-native-support.test.js > stdout 1`] = `
::error::A proxy environment variable is set, but Node.js native proxy support is not enabled. Set NODE_USE_ENV_PROXY=1 for this action step.
`;
exports[`main-repo-skew.test.js > stderr 1`] = `
'Issued at' claim ('iat') must be an Integer representing the time that the assertion was issued.
[@octokit/auth-app] GitHub API time and system time are different by 30 seconds. Retrying request with the difference accounted for.