mirror of
https://github.com/github/codeql-action.git
synced 2025-12-27 01:30:10 +08:00
Suppose a customer has a run where the init Action failed before saving a config file. When the customer opens their Actions logs, the UI currently focuses on the post init step, since this is the last step that failed. Demoting the error in the post init Action to a warning means that the UI will instead focus on the `init` step, which is more useful for debugging what went wrong.
32 lines
959 B
TypeScript
32 lines
959 B
TypeScript
import * as core from "@actions/core";
|
|
|
|
import * as actionsUtil from "./actions-util";
|
|
import { getConfig } from "./config-utils";
|
|
import { getActionsLogger } from "./logging";
|
|
|
|
export async function run(
|
|
uploadDatabaseBundleDebugArtifact: Function,
|
|
uploadLogsDebugArtifact: Function,
|
|
printDebugLogs: Function
|
|
) {
|
|
const logger = getActionsLogger();
|
|
|
|
const config = await getConfig(actionsUtil.getTemporaryDirectory(), logger);
|
|
if (config === undefined) {
|
|
logger.warning(
|
|
"Debugging artifacts are unavailable since the 'init' Action failed before it could produce any."
|
|
);
|
|
}
|
|
|
|
// Upload appropriate Actions artifacts for debugging
|
|
if (config?.debugMode) {
|
|
core.info(
|
|
"Debug mode is on. Uploading available database bundles and logs as Actions debugging artifacts..."
|
|
);
|
|
await uploadDatabaseBundleDebugArtifact(config, logger);
|
|
await uploadLogsDebugArtifact(config);
|
|
|
|
await printDebugLogs(config);
|
|
}
|
|
}
|