Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions lib/start-proxy-action-post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/start-proxy-action-post.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 25 additions & 26 deletions src/start-proxy-action-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,37 @@ import { getActionsLogger } from "./logging";
import { checkGitHubVersionInRange, getErrorMessage } from "./util";

async function runWrapper() {
const logger = getActionsLogger();

try {
// Restore inputs from `start-proxy` Action.
actionsUtil.restoreInputs();

// Kill the running proxy
const pid = core.getState("proxy-process-pid");
if (pid) {
process.kill(Number(pid));
}
} catch (error) {
core.setFailed(
`start-proxy post-action step failed: ${getErrorMessage(error)}`,
);
}
const config = await configUtils.getConfig(
actionsUtil.getTemporaryDirectory(),
core,
);

if ((config && config.debugMode) || core.isDebug()) {
const logFilePath = core.getState("proxy-log-file");
core.info(
"Debug mode is on. Uploading proxy log as Actions debugging artifact...",
const config = await configUtils.getConfig(
actionsUtil.getTemporaryDirectory(),
logger,
);
if (config?.gitHubVersion.type === undefined) {
core.warning(
`Did not upload debug artifacts because cannot determine the GitHub variant running.`,
);
return;
}

const logger = getActionsLogger();
const gitHubVersion = await getGitHubVersion();
checkGitHubVersionInRange(gitHubVersion, logger);
if ((config && config.debugMode) || core.isDebug()) {
const logFilePath = core.getState("proxy-log-file");
logger.info(
"Debug mode is on. Uploading proxy log as Actions debugging artifact...",
);
if (config?.gitHubVersion.type === undefined) {
logger.warning(
`Did not upload debug artifacts because cannot determine the GitHub variant running.`,
);
return;
}
const gitHubVersion = await getGitHubVersion();
checkGitHubVersionInRange(gitHubVersion, logger);

try {
const artifactUploader = await getArtifactUploaderClient(
logger,
gitHubVersion.type,
Expand All @@ -61,10 +58,12 @@ async function runWrapper() {
retentionDays: 7,
},
);
} catch (e) {
// A failure to upload debug artifacts should not fail the entire action.
core.warning(`Failed to upload debug artifacts: ${e}`);
}
} catch (error) {
// A failure in the post step should not fail the entire action.
logger.warning(
`start-proxy post-action step failed: ${getErrorMessage(error)}`,
);
}
}

Expand Down
4 changes: 4 additions & 0 deletions start-proxy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
proxy_password:
required: false
description: The password of the proxy
token:
description: GitHub token to use for authenticating with this instance of GitHub, used to upload debug artifacts.
default: ${{ github.token }}
required: false
outputs:
proxy_host:
description: The IP address of the proxy
Expand Down
Loading