mirror of
https://github.com/github/codeql-action.git
synced 2026-03-31 08:42:17 +00:00
Add check run ID
This commit is contained in:
@@ -159,6 +159,11 @@ inputs:
|
||||
description: >-
|
||||
Explicitly enable or disable caching of project build dependencies.
|
||||
required: false
|
||||
check-run-id:
|
||||
description: >-
|
||||
[Internal] The ID of the check run, as provided by the Actions runtime environment. Do not set this value manually.
|
||||
default: ${{ job.check_run_id }}
|
||||
required: false
|
||||
outputs:
|
||||
codeql-path:
|
||||
description: The path of the CodeQL binary used for analysis
|
||||
|
||||
27
lib/init-action-post.js
generated
27
lib/init-action-post.js
generated
@@ -166091,14 +166091,16 @@ function getStatusFilePath(languages) {
|
||||
STATUS_FILE_NAME
|
||||
);
|
||||
}
|
||||
function createOverlayStatus(attributes) {
|
||||
function createOverlayStatus(attributes, checkRunId) {
|
||||
const job = {
|
||||
workflowRunId: getWorkflowRunID(),
|
||||
workflowRunAttempt: getWorkflowRunAttempt(),
|
||||
name: getRequiredEnvParam("GITHUB_JOB"),
|
||||
...checkRunId !== void 0 && { checkRunId }
|
||||
};
|
||||
return {
|
||||
...attributes,
|
||||
job: {
|
||||
workflowRunId: getWorkflowRunID(),
|
||||
workflowRunAttempt: getWorkflowRunAttempt(),
|
||||
name: getRequiredEnvParam("GITHUB_JOB")
|
||||
}
|
||||
job
|
||||
};
|
||||
}
|
||||
async function saveOverlayStatus(codeql, languages, diskUsage, status, logger) {
|
||||
@@ -170365,10 +170367,15 @@ async function recordOverlayStatus(codeql, config, features, logger) {
|
||||
if (config.overlayDatabaseMode !== "overlay-base" /* OverlayBase */ || process.env["CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY" /* ANALYZE_DID_COMPLETE_SUCCESSFULLY */] === "true" || !await features.getValue("overlay_analysis_status_save" /* OverlayAnalysisStatusSave */)) {
|
||||
return;
|
||||
}
|
||||
const overlayStatus = createOverlayStatus({
|
||||
attemptedToBuildOverlayBaseDatabase: true,
|
||||
builtOverlayBaseDatabase: false
|
||||
});
|
||||
const checkRunIdInput = getOptionalInput("check-run-id");
|
||||
const checkRunId = checkRunIdInput !== void 0 ? parseInt(checkRunIdInput, 10) : void 0;
|
||||
const overlayStatus = createOverlayStatus(
|
||||
{
|
||||
attemptedToBuildOverlayBaseDatabase: true,
|
||||
builtOverlayBaseDatabase: false
|
||||
},
|
||||
Number.isNaN(checkRunId) ? void 0 : checkRunId
|
||||
);
|
||||
const diskUsage = await checkDiskUsage(logger);
|
||||
if (diskUsage === void 0) {
|
||||
logger.warning(
|
||||
|
||||
@@ -274,10 +274,17 @@ async function recordOverlayStatus(
|
||||
return;
|
||||
}
|
||||
|
||||
const overlayStatus: OverlayStatus = createOverlayStatus({
|
||||
attemptedToBuildOverlayBaseDatabase: true,
|
||||
builtOverlayBaseDatabase: false,
|
||||
});
|
||||
const checkRunIdInput = actionsUtil.getOptionalInput("check-run-id");
|
||||
const checkRunId =
|
||||
checkRunIdInput !== undefined ? parseInt(checkRunIdInput, 10) : undefined;
|
||||
|
||||
const overlayStatus: OverlayStatus = createOverlayStatus(
|
||||
{
|
||||
attemptedToBuildOverlayBaseDatabase: true,
|
||||
builtOverlayBaseDatabase: false,
|
||||
},
|
||||
Number.isNaN(checkRunId) ? undefined : checkRunId,
|
||||
);
|
||||
|
||||
const diskUsage = await checkDiskUsage(logger);
|
||||
if (diskUsage === undefined) {
|
||||
|
||||
@@ -45,6 +45,8 @@ function getStatusFilePath(languages: string[]): string {
|
||||
|
||||
/** Details of the job that recorded an overlay status. */
|
||||
interface JobInfo {
|
||||
/** The check run ID. This is optional since it is not always available. */
|
||||
checkRunId?: number;
|
||||
/** The workflow run ID. */
|
||||
workflowRunId: number;
|
||||
/** The workflow run attempt number. */
|
||||
@@ -66,14 +68,17 @@ export interface OverlayStatus {
|
||||
/** Creates an `OverlayStatus` populated with the details of the current job. */
|
||||
export function createOverlayStatus(
|
||||
attributes: Omit<OverlayStatus, "job">,
|
||||
checkRunId?: number,
|
||||
): OverlayStatus {
|
||||
const job: JobInfo = {
|
||||
workflowRunId: getWorkflowRunID(),
|
||||
workflowRunAttempt: getWorkflowRunAttempt(),
|
||||
name: getRequiredEnvParam("GITHUB_JOB"),
|
||||
...(checkRunId !== undefined && { checkRunId }),
|
||||
};
|
||||
return {
|
||||
...attributes,
|
||||
job: {
|
||||
workflowRunId: getWorkflowRunID(),
|
||||
workflowRunAttempt: getWorkflowRunAttempt(),
|
||||
name: getRequiredEnvParam("GITHUB_JOB"),
|
||||
},
|
||||
job,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user