Add and use getDisplayActionName for log message

This commit is contained in:
Michael B. Gale
2026-07-06 14:20:08 +01:00
parent eba9d55e1f
commit 5fa9c0c3e2
3 changed files with 28 additions and 3 deletions

10
lib/entry-points.js generated
View File

@@ -148799,6 +148799,12 @@ async function logGeneratedFilesTelemetry(config, duration, generatedFilesCount)
} }
// src/status-report.ts // src/status-report.ts
function getDisplayActionName(actionName) {
if (actionName === "finish" /* Analyze */) {
return "analyze";
}
return actionName;
}
function isFirstPartyAnalysis(actionName) { function isFirstPartyAnalysis(actionName) {
if (actionName !== "upload-sarif" /* UploadSarif */) { if (actionName !== "upload-sarif" /* UploadSarif */) {
return true; return true;
@@ -149088,7 +149094,9 @@ async function runInActions(action) {
actions: actionsEnv actions: actionsEnv
}); });
} catch (error3) { } catch (error3) {
core10.setFailed(`${action.name} action failed: ${getErrorMessage(error3)}`); core10.setFailed(
`${getDisplayActionName(action.name)} action failed: ${getErrorMessage(error3)}`
);
await sendUnhandledErrorStatusReport(action.name, startedAt, error3, logger); await sendUnhandledErrorStatusReport(action.name, startedAt, error3, logger);
} }
} }

View File

@@ -4,7 +4,11 @@ import { ActionsEnv, getActionsEnv } from "./actions-util";
import { Env } from "./environment"; import { Env } from "./environment";
import { FeatureEnablement } from "./feature-flags"; import { FeatureEnablement } from "./feature-flags";
import { getActionsLogger, Logger } from "./logging"; import { getActionsLogger, Logger } from "./logging";
import { ActionName, sendUnhandledErrorStatusReport } from "./status-report"; import {
ActionName,
getDisplayActionName,
sendUnhandledErrorStatusReport,
} from "./status-report";
import { getEnv, getErrorMessage } from "./util"; import { getEnv, getErrorMessage } from "./util";
/** Common state that is always available in `ActionState`. */ /** Common state that is always available in `ActionState`. */
@@ -83,7 +87,9 @@ export async function runInActions(action: Action) {
actions: actionsEnv, actions: actionsEnv,
}); });
} catch (error) { } catch (error) {
core.setFailed(`${action.name} action failed: ${getErrorMessage(error)}`); core.setFailed(
`${getDisplayActionName(action.name)} action failed: ${getErrorMessage(error)}`,
);
await sendUnhandledErrorStatusReport(action.name, startedAt, error, logger); await sendUnhandledErrorStatusReport(action.name, startedAt, error, logger);
} }
} }

View File

@@ -46,6 +46,17 @@ export enum ActionName {
UploadSarif = "upload-sarif", UploadSarif = "upload-sarif",
} }
/**
* Maps an `ActionName` to its display name. Usually that is the same, except
* for `ActionName.Analyze` where it is `"analyze"` instead of `"finish"`.
*/
export function getDisplayActionName(actionName: ActionName): string {
if (actionName === ActionName.Analyze) {
return "analyze";
}
return actionName;
}
/** /**
* @returns a boolean indicating whether the analysis is considered to be first party. * @returns a boolean indicating whether the analysis is considered to be first party.
* *