Skip to content

Commit 1907698

Browse files
committed
Use runInActions for the start-proxy post-action
1 parent a4c1eb2 commit 1907698

2 files changed

Lines changed: 79 additions & 49 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 54 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/start-proxy-action-post.ts‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,28 @@
55
*/
66
import * as core from "@actions/core";
77

8+
import {
9+
ActionName,
10+
runInActions,
11+
type Action,
12+
type ActionState,
13+
} from "./action-common";
814
import * as actionsUtil from "./actions-util";
915
import { getGitHubVersion } from "./api-client";
1016
import * as configUtils from "./config-utils";
1117
import { uploadArtifacts } from "./debug-artifacts";
12-
import { getActionsLogger } from "./logging";
18+
import { getSafeErrorMessage } from "./start-proxy/status-report";
1319
import { checkGitHubVersionInRange, getErrorMessage } from "./util";
1420

15-
export async function runWrapper() {
21+
/**
22+
* The main functionality of the `start-proxy` post-action is implemented by this function.
23+
* This is called once by {@link runInActions} after it is called in {@link runWrapper}.
24+
*/
25+
export async function run(action: ActionState<["Logger"]>) {
1626
// To capture errors appropriately, keep as much code within the try-catch as
1727
// possible, and only use safe functions outside.
1828

19-
const logger = getActionsLogger();
29+
const logger = action.logger;
2030

2131
try {
2232
// Restore inputs from `start-proxy` Action.
@@ -56,3 +66,15 @@ export async function runWrapper() {
5666
);
5767
}
5868
}
69+
70+
/** Defines the `start-proxy` post-action. */
71+
const startProxyPostAction: Action = {
72+
name: ActionName.StartProxyPost,
73+
run,
74+
transformTelemetryError: getSafeErrorMessage,
75+
};
76+
77+
/** The main entry point for the `start-proxy` post-action. */
78+
export async function runWrapper() {
79+
await runInActions(startProxyPostAction);
80+
}

0 commit comments

Comments
 (0)