Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 17 additions & 10 deletions lib/init-action-post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions src/init-action-post-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Comment thread
mbg marked this conversation as resolved.
Outdated
);

const diskUsage = await checkDiskUsage(logger);
if (diskUsage === undefined) {
Expand Down
15 changes: 10 additions & 5 deletions src/overlay/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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 }),
Comment thread
mbg marked this conversation as resolved.
Outdated
};
return {
...attributes,
job: {
workflowRunId: getWorkflowRunID(),
workflowRunAttempt: getWorkflowRunAttempt(),
name: getRequiredEnvParam("GITHUB_JOB"),
},
job,
};
}

Expand Down
Loading