mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 17:41:28 +00:00
Add and use getDisplayActionName for log message
This commit is contained in:
10
lib/entry-points.js
generated
10
lib/entry-points.js
generated
@@ -148799,6 +148799,12 @@ async function logGeneratedFilesTelemetry(config, duration, generatedFilesCount)
|
||||
}
|
||||
|
||||
// src/status-report.ts
|
||||
function getDisplayActionName(actionName) {
|
||||
if (actionName === "finish" /* Analyze */) {
|
||||
return "analyze";
|
||||
}
|
||||
return actionName;
|
||||
}
|
||||
function isFirstPartyAnalysis(actionName) {
|
||||
if (actionName !== "upload-sarif" /* UploadSarif */) {
|
||||
return true;
|
||||
@@ -149088,7 +149094,9 @@ async function runInActions(action) {
|
||||
actions: actionsEnv
|
||||
});
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,11 @@ import { ActionsEnv, getActionsEnv } from "./actions-util";
|
||||
import { Env } from "./environment";
|
||||
import { FeatureEnablement } from "./feature-flags";
|
||||
import { getActionsLogger, Logger } from "./logging";
|
||||
import { ActionName, sendUnhandledErrorStatusReport } from "./status-report";
|
||||
import {
|
||||
ActionName,
|
||||
getDisplayActionName,
|
||||
sendUnhandledErrorStatusReport,
|
||||
} from "./status-report";
|
||||
import { getEnv, getErrorMessage } from "./util";
|
||||
|
||||
/** Common state that is always available in `ActionState`. */
|
||||
@@ -83,7 +87,9 @@ export async function runInActions(action: Action) {
|
||||
actions: actionsEnv,
|
||||
});
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,17 @@ export enum ActionName {
|
||||
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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user