|
5 | 5 | */ |
6 | 6 | import * as core from "@actions/core"; |
7 | 7 |
|
| 8 | +import { |
| 9 | + ActionName, |
| 10 | + runInActions, |
| 11 | + type Action, |
| 12 | + type ActionState, |
| 13 | +} from "./action-common"; |
8 | 14 | import * as actionsUtil from "./actions-util"; |
9 | 15 | import { getGitHubVersion } from "./api-client"; |
10 | 16 | import * as configUtils from "./config-utils"; |
11 | 17 | import { uploadArtifacts } from "./debug-artifacts"; |
12 | | -import { getActionsLogger } from "./logging"; |
| 18 | +import { getSafeErrorMessage } from "./start-proxy/status-report"; |
13 | 19 | import { checkGitHubVersionInRange, getErrorMessage } from "./util"; |
14 | 20 |
|
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"]>) { |
16 | 26 | // To capture errors appropriately, keep as much code within the try-catch as |
17 | 27 | // possible, and only use safe functions outside. |
18 | 28 |
|
19 | | - const logger = getActionsLogger(); |
| 29 | + const logger = action.logger; |
20 | 30 |
|
21 | 31 | try { |
22 | 32 | // Restore inputs from `start-proxy` Action. |
@@ -56,3 +66,15 @@ export async function runWrapper() { |
56 | 66 | ); |
57 | 67 | } |
58 | 68 | } |
| 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