Skip to content

Commit f327a84

Browse files
committed
Avoid failing the workflow on a proxy post step
1 parent 4d64ab6 commit f327a84

File tree

3 files changed

+41
-47
lines changed

3 files changed

+41
-47
lines changed

lib/start-proxy-action-post.js

+16-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/start-proxy-action-post.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/start-proxy-action-post.ts

+24-26
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,38 @@ import { getActionsLogger } from "./logging";
1313
import { checkGitHubVersionInRange, getErrorMessage } from "./util";
1414

1515
async function runWrapper() {
16+
const logger = getActionsLogger();
17+
1618
try {
1719
// Restore inputs from `start-proxy` Action.
1820
actionsUtil.restoreInputs();
21+
22+
// Kill the running proxy
1923
const pid = core.getState("proxy-process-pid");
2024
if (pid) {
2125
process.kill(Number(pid));
2226
}
23-
} catch (error) {
24-
core.setFailed(
25-
`start-proxy post-action step failed: ${getErrorMessage(error)}`,
26-
);
27-
}
28-
const config = await configUtils.getConfig(
29-
actionsUtil.getTemporaryDirectory(),
30-
core,
31-
);
3227

33-
if ((config && config.debugMode) || core.isDebug()) {
34-
const logFilePath = core.getState("proxy-log-file");
35-
core.info(
36-
"Debug mode is on. Uploading proxy log as Actions debugging artifact...",
28+
29+
const config = await configUtils.getConfig(
30+
actionsUtil.getTemporaryDirectory(),
31+
logger,
3732
);
38-
if (config?.gitHubVersion.type === undefined) {
39-
core.warning(
40-
`Did not upload debug artifacts because cannot determine the GitHub variant running.`,
41-
);
42-
return;
43-
}
4433

45-
const logger = getActionsLogger();
46-
const gitHubVersion = await getGitHubVersion();
47-
checkGitHubVersionInRange(gitHubVersion, logger);
34+
if ((config && config.debugMode) || core.isDebug()) {
35+
const logFilePath = core.getState("proxy-log-file");
36+
logger.info(
37+
"Debug mode is on. Uploading proxy log as Actions debugging artifact...",
38+
);
39+
if (config?.gitHubVersion.type === undefined) {
40+
logger.warning(
41+
`Did not upload debug artifacts because cannot determine the GitHub variant running.`,
42+
);
43+
return;
44+
}
45+
const gitHubVersion = await getGitHubVersion();
46+
checkGitHubVersionInRange(gitHubVersion, logger);
4847

49-
try {
5048
const artifactUploader = await getArtifactUploaderClient(
5149
logger,
5250
gitHubVersion.type,
@@ -61,10 +59,10 @@ async function runWrapper() {
6159
retentionDays: 7,
6260
},
6361
);
64-
} catch (e) {
65-
// A failure to upload debug artifacts should not fail the entire action.
66-
core.warning(`Failed to upload debug artifacts: ${e}`);
6762
}
63+
} catch(error) {
64+
// A failure in the post step should not fail the entire action.
65+
logger.warning(`start-proxy post-action step failed: ${getErrorMessage(error)}`);
6866
}
6967
}
7068

0 commit comments

Comments
 (0)