mirror of
https://github.com/github/codeql-action.git
synced 2026-10-21 02:01:27 +00:00
Use runInActions for the analyze post-action
This commit is contained in:
127
lib/entry-points.js
generated
127
lib/entry-points.js
generated
@@ -28816,7 +28816,7 @@ var require_light = __commonJS({
|
||||
}
|
||||
return this.Events.trigger("scheduled", { args: this.args, options: this.options });
|
||||
}
|
||||
async doExecute(chained, clearGlobalState, run10, free) {
|
||||
async doExecute(chained, clearGlobalState, run11, free) {
|
||||
var error3, eventInfo, passed;
|
||||
if (this.retryCount === 0) {
|
||||
this._assertStatus("RUNNING");
|
||||
@@ -28836,10 +28836,10 @@ var require_light = __commonJS({
|
||||
}
|
||||
} catch (error1) {
|
||||
error3 = error1;
|
||||
return this._onFailure(error3, eventInfo, clearGlobalState, run10, free);
|
||||
return this._onFailure(error3, eventInfo, clearGlobalState, run11, free);
|
||||
}
|
||||
}
|
||||
doExpire(clearGlobalState, run10, free) {
|
||||
doExpire(clearGlobalState, run11, free) {
|
||||
var error3, eventInfo;
|
||||
if (this._states.jobStatus(this.options.id === "RUNNING")) {
|
||||
this._states.next(this.options.id);
|
||||
@@ -28847,9 +28847,9 @@ var require_light = __commonJS({
|
||||
this._assertStatus("EXECUTING");
|
||||
eventInfo = { args: this.args, options: this.options, retryCount: this.retryCount };
|
||||
error3 = new BottleneckError$1(`This job timed out after ${this.options.expiration} ms.`);
|
||||
return this._onFailure(error3, eventInfo, clearGlobalState, run10, free);
|
||||
return this._onFailure(error3, eventInfo, clearGlobalState, run11, free);
|
||||
}
|
||||
async _onFailure(error3, eventInfo, clearGlobalState, run10, free) {
|
||||
async _onFailure(error3, eventInfo, clearGlobalState, run11, free) {
|
||||
var retry2, retryAfter;
|
||||
if (clearGlobalState()) {
|
||||
retry2 = await this.Events.trigger("failed", error3, eventInfo);
|
||||
@@ -28857,7 +28857,7 @@ var require_light = __commonJS({
|
||||
retryAfter = ~~retry2;
|
||||
this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo);
|
||||
this.retryCount++;
|
||||
return run10(retryAfter);
|
||||
return run11(retryAfter);
|
||||
} else {
|
||||
this.doDone(eventInfo);
|
||||
await free(this.options, eventInfo);
|
||||
@@ -29495,17 +29495,17 @@ var require_light = __commonJS({
|
||||
}
|
||||
}
|
||||
_run(index2, job, wait) {
|
||||
var clearGlobalState, free, run10;
|
||||
var clearGlobalState, free, run11;
|
||||
job.doRun();
|
||||
clearGlobalState = this._clearGlobalState.bind(this, index2);
|
||||
run10 = this._run.bind(this, index2, job);
|
||||
run11 = this._run.bind(this, index2, job);
|
||||
free = this._free.bind(this, index2, job);
|
||||
return this._scheduled[index2] = {
|
||||
timeout: setTimeout(() => {
|
||||
return job.doExecute(this._limiter, clearGlobalState, run10, free);
|
||||
return job.doExecute(this._limiter, clearGlobalState, run11, free);
|
||||
}, wait),
|
||||
expiration: job.options.expiration != null ? setTimeout(function() {
|
||||
return job.doExpire(clearGlobalState, run10, free);
|
||||
return job.doExpire(clearGlobalState, run11, free);
|
||||
}, wait + job.options.expiration) : void 0,
|
||||
job
|
||||
};
|
||||
@@ -51046,14 +51046,14 @@ var require_crc64 = __commonJS({
|
||||
missingLibrarySymbols.forEach(missingLibrarySymbol);
|
||||
var calledRun;
|
||||
dependenciesFulfilled = function runCaller() {
|
||||
if (!calledRun) run10();
|
||||
if (!calledRun) run11();
|
||||
if (!calledRun) dependenciesFulfilled = runCaller;
|
||||
};
|
||||
function stackCheckInit() {
|
||||
_emscripten_stack_init();
|
||||
writeStackCookie();
|
||||
}
|
||||
function run10(args) {
|
||||
function run11(args) {
|
||||
args = args || arguments_;
|
||||
if (runDependencies > 0) {
|
||||
return;
|
||||
@@ -51111,7 +51111,7 @@ var require_crc64 = __commonJS({
|
||||
Module["preInit"].pop()();
|
||||
}
|
||||
}
|
||||
run10();
|
||||
run11();
|
||||
function WrapperObject() {
|
||||
}
|
||||
WrapperObject.prototype = Object.create(WrapperObject.prototype);
|
||||
@@ -114994,8 +114994,8 @@ var require_async = __commonJS({
|
||||
return callback(null, results);
|
||||
}
|
||||
while (readyTasks.length && runningTasks < concurrency) {
|
||||
var run10 = readyTasks.shift();
|
||||
run10();
|
||||
var run11 = readyTasks.shift();
|
||||
run11();
|
||||
}
|
||||
}
|
||||
function addListener(taskName, fn) {
|
||||
@@ -179643,9 +179643,9 @@ async function addFingerprints(sarifLog, sourceRoot, logger2) {
|
||||
`Adding fingerprints to SARIF file. See ${"https://docs.github.com/en/code-security/reference/code-scanning/sarif-support-for-code-scanning#data-for-preventing-duplicated-alerts" /* TRACK_CODE_SCANNING_ALERTS_ACROSS_RUNS */} for more information.`
|
||||
);
|
||||
const callbacksByFile = {};
|
||||
for (const run10 of sarifLog.runs || []) {
|
||||
const artifacts = run10.artifacts || [];
|
||||
for (const result of run10.results || []) {
|
||||
for (const run11 of sarifLog.runs || []) {
|
||||
const artifacts = run11.artifacts || [];
|
||||
for (const result of run11.results || []) {
|
||||
const primaryLocation = (result.locations || [])[0];
|
||||
if (!primaryLocation?.physicalLocation?.artifactLocation) {
|
||||
logger2.debug(
|
||||
@@ -179920,8 +179920,8 @@ var InvalidSarifUploadError = class extends Error {
|
||||
};
|
||||
function getToolNames(sarifFile) {
|
||||
const toolNames = {};
|
||||
for (const run10 of sarifFile.runs || []) {
|
||||
const tool = run10.tool || {};
|
||||
for (const run11 of sarifFile.runs || []) {
|
||||
const tool = run11.tool || {};
|
||||
const driver = tool.driver || {};
|
||||
if (typeof driver.name === "string" && driver.name.length > 0) {
|
||||
toolNames[driver.name] = true;
|
||||
@@ -179961,17 +179961,17 @@ function combineSarifFiles(sarifFiles, logger2) {
|
||||
}
|
||||
function areAllRunsProducedByCodeQL(sarifLogs) {
|
||||
return sarifLogs.every((sarifLog) => {
|
||||
return sarifLog.runs?.every((run10) => run10.tool?.driver?.name === "CodeQL");
|
||||
return sarifLog.runs?.every((run11) => run11.tool?.driver?.name === "CodeQL");
|
||||
});
|
||||
}
|
||||
function createRunKey(run10) {
|
||||
function createRunKey(run11) {
|
||||
return {
|
||||
name: run10.tool?.driver?.name,
|
||||
fullName: run10.tool?.driver?.fullName,
|
||||
version: run10.tool?.driver?.version,
|
||||
semanticVersion: run10.tool?.driver?.semanticVersion,
|
||||
guid: run10.tool?.driver?.guid,
|
||||
automationId: run10.automationDetails?.id
|
||||
name: run11.tool?.driver?.name,
|
||||
fullName: run11.tool?.driver?.fullName,
|
||||
version: run11.tool?.driver?.version,
|
||||
semanticVersion: run11.tool?.driver?.semanticVersion,
|
||||
guid: run11.tool?.driver?.guid,
|
||||
automationId: run11.automationDetails?.id
|
||||
};
|
||||
}
|
||||
function areAllRunsUnique(sarifLogs) {
|
||||
@@ -179980,8 +179980,8 @@ function areAllRunsUnique(sarifLogs) {
|
||||
if (sarifLog.runs === void 0) {
|
||||
continue;
|
||||
}
|
||||
for (const run10 of sarifLog.runs) {
|
||||
const key = JSON.stringify(createRunKey(run10));
|
||||
for (const run11 of sarifLog.runs) {
|
||||
const key = JSON.stringify(createRunKey(run11));
|
||||
if (keys.has(key)) {
|
||||
return false;
|
||||
}
|
||||
@@ -180084,9 +180084,9 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
function populateRunAutomationDetails(sarifFile, category, analysis_key, environment) {
|
||||
const automationID = getAutomationID2(category, analysis_key, environment);
|
||||
if (automationID !== void 0) {
|
||||
for (const run10 of sarifFile.runs || []) {
|
||||
if (run10.automationDetails === void 0) {
|
||||
run10.automationDetails = {
|
||||
for (const run11 of sarifFile.runs || []) {
|
||||
if (run11.automationDetails === void 0) {
|
||||
run11.automationDetails = {
|
||||
id: automationID
|
||||
};
|
||||
}
|
||||
@@ -180233,13 +180233,13 @@ function countResultsInSarif(sarifLog) {
|
||||
if (!Array.isArray(parsedSarif.runs)) {
|
||||
throw new InvalidSarifUploadError("Invalid SARIF. Missing 'runs' array.");
|
||||
}
|
||||
for (const run10 of parsedSarif.runs) {
|
||||
if (!Array.isArray(run10.results)) {
|
||||
for (const run11 of parsedSarif.runs) {
|
||||
if (!Array.isArray(run11.results)) {
|
||||
throw new InvalidSarifUploadError(
|
||||
"Invalid SARIF. Missing 'results' array in run."
|
||||
);
|
||||
}
|
||||
numResults += run10.results.length;
|
||||
numResults += run11.results.length;
|
||||
}
|
||||
return numResults;
|
||||
}
|
||||
@@ -180566,9 +180566,9 @@ function handleProcessingResultForUnsuccessfulExecution(response, status, logger
|
||||
}
|
||||
function validateUniqueCategory(sarifLog, sentinelPrefix) {
|
||||
const categories = {};
|
||||
for (const run10 of sarifLog.runs || []) {
|
||||
const id = run10?.automationDetails?.id;
|
||||
const tool = run10.tool?.driver?.name;
|
||||
for (const run11 of sarifLog.runs || []) {
|
||||
const id = run11?.automationDetails?.id;
|
||||
const tool = run11.tool?.driver?.name;
|
||||
const category = `${sanitize(id)}_${sanitize(tool)}`;
|
||||
categories[category] = { id, tool };
|
||||
}
|
||||
@@ -180593,9 +180593,9 @@ function filterAlertsByDiffRange(logger2, sarifLog) {
|
||||
if (sarifLog.runs === void 0) {
|
||||
return sarifLog;
|
||||
}
|
||||
for (const run10 of sarifLog.runs) {
|
||||
if (run10.results) {
|
||||
run10.results = run10.results.filter((result) => {
|
||||
for (const run11 of sarifLog.runs) {
|
||||
if (run11.results) {
|
||||
run11.results = run11.results.filter((result) => {
|
||||
const locations = [
|
||||
...(result.locations || []).map((loc) => loc.physicalLocation),
|
||||
...(result.relatedLocations || []).map((loc) => loc.physicalLocation)
|
||||
@@ -185899,9 +185899,9 @@ async function createDatabaseBundleCli(codeql, config, language) {
|
||||
}
|
||||
|
||||
// src/analyze-action-post.ts
|
||||
async function runWrapper2() {
|
||||
async function run2(action) {
|
||||
const logger2 = action.logger;
|
||||
try {
|
||||
const logger2 = getActionsLogger();
|
||||
restoreInputs(logger2);
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
checkGitHubVersionInRange(gitHubVersion, logger2);
|
||||
@@ -185938,6 +185938,13 @@ async function runWrapper2() {
|
||||
);
|
||||
}
|
||||
}
|
||||
var analyzePostAction = {
|
||||
name: "analyze-post" /* AnalyzePost */,
|
||||
run: run2
|
||||
};
|
||||
async function runWrapper2() {
|
||||
await runInActions(analyzePostAction);
|
||||
}
|
||||
|
||||
// src/autobuild-action.ts
|
||||
var core17 = __toESM(require_core());
|
||||
@@ -185963,7 +185970,7 @@ async function sendCompletedStatusReport(config, logger2, startedAt, allLanguage
|
||||
await sendStatusReport(statusReport);
|
||||
}
|
||||
}
|
||||
async function run2({
|
||||
async function run3({
|
||||
startedAt,
|
||||
env,
|
||||
logger: logger2
|
||||
@@ -186028,7 +186035,7 @@ async function run2({
|
||||
}
|
||||
var autobuild = {
|
||||
name: "autobuild" /* Autobuild */,
|
||||
run: run2
|
||||
run: run3
|
||||
};
|
||||
async function runWrapper3() {
|
||||
await runInActions(autobuild);
|
||||
@@ -186437,7 +186444,7 @@ async function sendCompletedStatusReport2(startedAt, config, configFile, toolsIn
|
||||
await sendStatusReport({ ...initStatusReport, ...initToolsDownloadFields });
|
||||
}
|
||||
}
|
||||
async function run3(actionState) {
|
||||
async function run4(actionState) {
|
||||
const startedAt = actionState.startedAt;
|
||||
const logger2 = actionState.logger;
|
||||
let apiDetails;
|
||||
@@ -186877,7 +186884,7 @@ exec ${goBinaryPath} "$@"`
|
||||
}
|
||||
var init = {
|
||||
name: "init" /* Init */,
|
||||
run: run3
|
||||
run: run4
|
||||
};
|
||||
async function runWrapper4() {
|
||||
await runInActions(init);
|
||||
@@ -187224,7 +187231,7 @@ async function removeUploadedSarif(uploadFailedSarifResult, logger2) {
|
||||
}
|
||||
|
||||
// src/init-action-post.ts
|
||||
async function run4(action) {
|
||||
async function run5(action) {
|
||||
const logger2 = action.logger;
|
||||
let config;
|
||||
let uploadFailedSarifResult;
|
||||
@@ -187339,7 +187346,7 @@ function getJobStatusFromEnvironment(env) {
|
||||
}
|
||||
var initPost = {
|
||||
name: "init-post" /* InitPost */,
|
||||
run: run4
|
||||
run: run5
|
||||
};
|
||||
async function runWrapper5() {
|
||||
return await runInActions(initPost);
|
||||
@@ -187362,7 +187369,7 @@ async function runResolveBuildEnvironment(cmd, logger2, workingDir, language) {
|
||||
|
||||
// src/resolve-environment-action.ts
|
||||
var ENVIRONMENT_OUTPUT_NAME = "environment";
|
||||
async function run5(startedAt) {
|
||||
async function run6(startedAt) {
|
||||
const logger2 = getActionsLogger();
|
||||
let config;
|
||||
try {
|
||||
@@ -187437,7 +187444,7 @@ async function runWrapper6() {
|
||||
const startedAt = /* @__PURE__ */ new Date();
|
||||
const logger2 = getActionsLogger();
|
||||
try {
|
||||
await run5(startedAt);
|
||||
await run6(startedAt);
|
||||
} catch (error3) {
|
||||
core21.setFailed(
|
||||
`${"resolve-environment" /* ResolveEnvironment */} action failed: ${getErrorMessage(
|
||||
@@ -187486,7 +187493,7 @@ async function sendCompletedStatusReport3(startedAt, toolsInput, toolsDownloadSt
|
||||
);
|
||||
await sendStatusReport({ ...initStatusReport, ...initToolsDownloadFields });
|
||||
}
|
||||
async function run6(actionState) {
|
||||
async function run7(actionState) {
|
||||
const { logger: logger2, startedAt } = actionState;
|
||||
let codeql;
|
||||
let toolsInput;
|
||||
@@ -187593,7 +187600,7 @@ async function run6(actionState) {
|
||||
}
|
||||
var setupCodeQL2 = {
|
||||
name: "setup-codeql" /* SetupCodeQL */,
|
||||
run: run6
|
||||
run: run7
|
||||
};
|
||||
async function runWrapper7() {
|
||||
await runInActions(setupCodeQL2);
|
||||
@@ -188263,7 +188270,7 @@ async function checkConnections(logger2, proxy, backend) {
|
||||
}
|
||||
|
||||
// src/start-proxy-action.ts
|
||||
async function run7(action) {
|
||||
async function run8(action) {
|
||||
const startedAt = action.startedAt;
|
||||
const logger2 = action.logger;
|
||||
let features;
|
||||
@@ -188338,7 +188345,7 @@ async function run7(action) {
|
||||
}
|
||||
var startProxyAction = {
|
||||
name: "start-proxy" /* StartProxy */,
|
||||
run: run7,
|
||||
run: run8,
|
||||
transformTelemetryError: getSafeErrorMessage
|
||||
};
|
||||
async function runWrapper8() {
|
||||
@@ -188394,7 +188401,7 @@ async function startProxy(binPath, config, logFilePath, logger2) {
|
||||
|
||||
// src/start-proxy-action-post.ts
|
||||
var core26 = __toESM(require_core());
|
||||
async function run8(action) {
|
||||
async function run9(action) {
|
||||
const logger2 = action.logger;
|
||||
try {
|
||||
restoreInputs(logger2);
|
||||
@@ -188429,7 +188436,7 @@ async function run8(action) {
|
||||
}
|
||||
var startProxyPostAction = {
|
||||
name: "start-proxy-post" /* StartProxyPost */,
|
||||
run: run8,
|
||||
run: run9,
|
||||
transformTelemetryError: getSafeErrorMessage
|
||||
};
|
||||
async function runWrapper9() {
|
||||
@@ -188455,7 +188462,7 @@ async function sendSuccessStatusReport2(startedAt, uploadStats, logger2) {
|
||||
await sendStatusReport(statusReport);
|
||||
}
|
||||
}
|
||||
async function run9({ startedAt, logger: logger2 }) {
|
||||
async function run10({ startedAt, logger: logger2 }) {
|
||||
try {
|
||||
initializeEnvironment(getActionVersion());
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
@@ -188540,7 +188547,7 @@ async function run9({ startedAt, logger: logger2 }) {
|
||||
}
|
||||
var uploadSarif = {
|
||||
name: "upload-sarif" /* UploadSarif */,
|
||||
run: run9
|
||||
run: run10
|
||||
};
|
||||
async function runWrapper10() {
|
||||
await runInActions(uploadSarif);
|
||||
|
||||
@@ -7,6 +7,12 @@ import * as fs from "fs";
|
||||
|
||||
import * as core from "@actions/core";
|
||||
|
||||
import {
|
||||
ActionName,
|
||||
runInActions,
|
||||
type Action,
|
||||
type ActionState,
|
||||
} from "./action-common";
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import { getGitHubVersion } from "./api-client";
|
||||
import { getConfig } from "./config-utils";
|
||||
@@ -16,15 +22,18 @@ import {
|
||||
getJavaTempDependencyDir,
|
||||
} from "./dependency-caching";
|
||||
import { EnvVar } from "./environment";
|
||||
import { getActionsLogger } from "./logging";
|
||||
import { checkGitHubVersionInRange, getErrorMessage } from "./util";
|
||||
|
||||
export async function runWrapper() {
|
||||
/**
|
||||
* The main functionality of the `analyze` post-action is implemented by this function.
|
||||
* This is called once by {@link runInActions} after it is called in {@link runWrapper}.
|
||||
*/
|
||||
export async function run(action: ActionState<["Logger"]>) {
|
||||
// To capture errors appropriately, keep as much code within the try-catch as
|
||||
// possible, and only use safe functions outside.
|
||||
const logger = action.logger;
|
||||
|
||||
try {
|
||||
const logger = getActionsLogger();
|
||||
actionsUtil.restoreInputs(logger);
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||
@@ -68,3 +77,14 @@ export async function runWrapper() {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** Defines the `analyze` post-action. */
|
||||
const analyzePostAction: Action = {
|
||||
name: ActionName.AnalyzePost,
|
||||
run,
|
||||
};
|
||||
|
||||
/** The main entry point for the `analyze` post-action. */
|
||||
export async function runWrapper() {
|
||||
await runInActions(analyzePostAction);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user