Compare commits

...

2 Commits

Author SHA1 Message Date
Angela P Wen
c432b64d5f Drive-by linting fix
Previously we were implicitly converting `any` type to `string`; this does so explicitly.
2023-04-06 11:57:58 -07:00
Angela P Wen
ae671fc041 Add workflow_run_attempt data to status report 2023-04-06 11:57:48 -07:00
6 changed files with 22 additions and 8 deletions

6
lib/actions-util.js generated
View File

@@ -295,6 +295,11 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
if (workflowRunIDStr) { if (workflowRunIDStr) {
workflowRunID = parseInt(workflowRunIDStr, 10); workflowRunID = parseInt(workflowRunIDStr, 10);
} }
const workflowRunAttemptStr = process.env["GITHUB_RUN_ATTEMPT"];
let workflowRunAttempt = -1;
if (workflowRunAttemptStr) {
workflowRunAttempt = parseInt(workflowRunAttemptStr, 10);
}
const workflowName = process.env["GITHUB_WORKFLOW"] || ""; const workflowName = process.env["GITHUB_WORKFLOW"] || "";
const jobName = process.env["GITHUB_JOB"] || ""; const jobName = process.env["GITHUB_JOB"] || "";
const analysis_key = await getAnalysisKey(); const analysis_key = await getAnalysisKey();
@@ -314,6 +319,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
} }
const statusReport = { const statusReport = {
workflow_run_id: workflowRunID, workflow_run_id: workflowRunID,
workflow_run_attempt: workflowRunAttempt,
workflow_name: workflowName, workflow_name: workflowName,
job_name: jobName, job_name: jobName,
analysis_key, analysis_key,

File diff suppressed because one or more lines are too long

6
lib/util.js generated
View File

@@ -337,9 +337,9 @@ exports.assertNever = assertNever;
* knowing what version of CodeQL we're running. * knowing what version of CodeQL we're running.
*/ */
function initializeEnvironment(version) { function initializeEnvironment(version) {
core.exportVariable(shared_environment_1.EnvVar.VERSION, version); core.exportVariable(String(shared_environment_1.EnvVar.VERSION), version);
core.exportVariable(shared_environment_1.EnvVar.FEATURE_SARIF_COMBINE, "true"); core.exportVariable(String(shared_environment_1.EnvVar.FEATURE_SARIF_COMBINE), "true");
core.exportVariable(shared_environment_1.EnvVar.FEATURE_WILL_UPLOAD, "true"); core.exportVariable(String(shared_environment_1.EnvVar.FEATURE_WILL_UPLOAD), "true");
} }
exports.initializeEnvironment = initializeEnvironment; exports.initializeEnvironment = initializeEnvironment;
/** /**

File diff suppressed because one or more lines are too long

View File

@@ -313,6 +313,8 @@ export type ActionStatus =
export interface StatusReportBase { export interface StatusReportBase {
/** ID of the workflow run containing the action run. */ /** ID of the workflow run containing the action run. */
workflow_run_id: number; workflow_run_id: number;
/** Attempt number of the run containing the action run. */
workflow_run_attempt: number;
/** Workflow name. Converted to analysis_name further down the pipeline.. */ /** Workflow name. Converted to analysis_name further down the pipeline.. */
workflow_name: string; workflow_name: string;
/** Job name from the workflow. */ /** Job name from the workflow. */
@@ -410,6 +412,11 @@ export async function createStatusReportBase(
if (workflowRunIDStr) { if (workflowRunIDStr) {
workflowRunID = parseInt(workflowRunIDStr, 10); workflowRunID = parseInt(workflowRunIDStr, 10);
} }
const workflowRunAttemptStr = process.env["GITHUB_RUN_ATTEMPT"];
let workflowRunAttempt = -1;
if (workflowRunAttemptStr) {
workflowRunAttempt = parseInt(workflowRunAttemptStr, 10);
}
const workflowName = process.env["GITHUB_WORKFLOW"] || ""; const workflowName = process.env["GITHUB_WORKFLOW"] || "";
const jobName = process.env["GITHUB_JOB"] || ""; const jobName = process.env["GITHUB_JOB"] || "";
const analysis_key = await getAnalysisKey(); const analysis_key = await getAnalysisKey();
@@ -437,6 +444,7 @@ export async function createStatusReportBase(
const statusReport: StatusReportBase = { const statusReport: StatusReportBase = {
workflow_run_id: workflowRunID, workflow_run_id: workflowRunID,
workflow_run_attempt: workflowRunAttempt,
workflow_name: workflowName, workflow_name: workflowName,
job_name: jobName, job_name: jobName,
analysis_key, analysis_key,

View File

@@ -438,9 +438,9 @@ export function assertNever(value: never): never {
* knowing what version of CodeQL we're running. * knowing what version of CodeQL we're running.
*/ */
export function initializeEnvironment(version: string) { export function initializeEnvironment(version: string) {
core.exportVariable(EnvVar.VERSION, version); core.exportVariable(String(EnvVar.VERSION), version);
core.exportVariable(EnvVar.FEATURE_SARIF_COMBINE, "true"); core.exportVariable(String(EnvVar.FEATURE_SARIF_COMBINE), "true");
core.exportVariable(EnvVar.FEATURE_WILL_UPLOAD, "true"); core.exportVariable(String(EnvVar.FEATURE_WILL_UPLOAD), "true");
} }
/** /**