codeql-action/src/analyze-action-post.ts

26 lines
848 B
TypeScript

/**
* This file is the entry point for the `post:` hook of `analyze-action.yml`.
* It will run after the all steps in this job, in reverse order in relation to
* other `post:` hooks.
*/
import * as core from "@actions/core";
import * as debugArtifacts from "./debug-artifacts";
import { EnvVar } from "./environment";
import { wrapError } from "./util";
async function runWrapper() {
try {
// Upload SARIF artifacts if we determine that this is a first-party analysis run.
// For third-party runs, this artifact will be uploaded in the `upload-sarif-post` step.
if (process.env[EnvVar.INIT_ACTION_HAS_RUN] === "true") {
await debugArtifacts.uploadCombinedSarifArtifacts();
}
} catch (error) {
core.setFailed(
`analyze post-action step failed: ${wrapError(error).message}`,
);
}
}
void runWrapper();