Skip to content

Commit f055b5e

Browse files
authored
Merge pull request #2197 from github/henrymercer/log-job-status
Log job status in the "Post init" step
2 parents 0d680ab + e402144 commit f055b5e

6 files changed

+40
-3
lines changed

lib/init-action-post.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action-post.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/status-report.js

+16-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/status-report.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/init-action-post.ts

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
createStatusReportBase,
2121
getActionsStatus,
2222
ActionName,
23+
getJobStatusDisplayName,
2324
} from "./status-report";
2425
import {
2526
checkDiskUsage,
@@ -89,6 +90,9 @@ async function runWrapper() {
8990
);
9091
return;
9192
}
93+
const jobStatus = initActionPostHelper.getFinalJobStatus();
94+
logger.info(`CodeQL job status was ${getJobStatusDisplayName(jobStatus)}.`);
95+
9296
const statusReportBase = await createStatusReportBase(
9397
ActionName.InitPost,
9498
"success",

src/status-report.ts

+16
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
isInTestMode,
2424
GITHUB_DOTCOM_URL,
2525
DiskUsage,
26+
assertNever,
2627
} from "./util";
2728

2829
export enum ActionName {
@@ -171,6 +172,21 @@ export function getActionsStatus(
171172
}
172173
}
173174

175+
export function getJobStatusDisplayName(status: JobStatus): string {
176+
switch (status) {
177+
case JobStatus.SuccessStatus:
178+
return "success";
179+
case JobStatus.FailureStatus:
180+
return "failure";
181+
case JobStatus.ConfigErrorStatus:
182+
return "configuration error";
183+
case JobStatus.UnknownStatus:
184+
return "unknown";
185+
default:
186+
assertNever(status);
187+
}
188+
}
189+
174190
/**
175191
* Sets the overall job status environment variable to configuration error
176192
* or failure, unless it's already been set to one of these values in a

0 commit comments

Comments
 (0)