Skip to content

Commit 092833b

Browse files
committed
Use runInActions for the upload-sarif post-action
1 parent 7fac6c0 commit 092833b

2 files changed

Lines changed: 71 additions & 48 deletions

File tree

‎lib/entry-points.js‎

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

‎src/upload-sarif-action-post.ts‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,25 @@
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 debugArtifacts from "./debug-artifacts";
1117
import { EnvVar } from "./environment";
12-
import { getActionsLogger, withGroup } from "./logging";
18+
import { withGroup } from "./logging";
1319
import { checkGitHubVersionInRange, getErrorMessage } from "./util";
1420

15-
export async function runWrapper() {
21+
export async function run(action: ActionState<["Logger"]>) {
1622
// To capture errors appropriately, keep as much code within the try-catch as
1723
// possible, and only use safe functions outside.
24+
const logger = action.logger;
1825

1926
try {
20-
const logger = getActionsLogger();
21-
2227
// Restore inputs from `upload-sarif` Action.
2328
actionsUtil.restoreInputs(logger);
2429
const gitHubVersion = await getGitHubVersion();
@@ -43,3 +48,14 @@ export async function runWrapper() {
4348
);
4449
}
4550
}
51+
52+
/** Defines the `upload-sarif` post-action. */
53+
const uploadSarifPostAction: Action = {
54+
name: ActionName.UploadSarifPost,
55+
run,
56+
};
57+
58+
/** The main entry point for the `upload-sarif` post-action. */
59+
export async function runWrapper() {
60+
await runInActions(uploadSarifPostAction);
61+
}

0 commit comments

Comments
 (0)