Send job_run_uuid to status report telemetry (#1685)

This commit is contained in:
Angela P Wen 2023-06-20 23:45:51 -07:00 committed by GitHub
parent 8ba77ef4d3
commit 4385ad5563
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 126 additions and 11 deletions

10
lib/actions-util.js generated
View file

@ -42,9 +42,9 @@ const pkg = require("../package.json");
*
* This allows us to get stronger type checking of required/optional inputs.
*/
function getRequiredInput(name) {
const getRequiredInput = function (name) {
return core.getInput(name, { required: true });
}
};
exports.getRequiredInput = getRequiredInput;
/**
* Wrapper around core.getInput that converts empty inputs to undefined.
@ -172,7 +172,7 @@ async function getAnalysisKey() {
exports.getAnalysisKey = getAnalysisKey;
async function getAutomationID() {
const analysis_key = await getAnalysisKey();
const environment = getRequiredInput("matrix");
const environment = (0, exports.getRequiredInput)("matrix");
return computeAutomationID(analysis_key, environment);
}
exports.getAutomationID = getAutomationID;
@ -290,6 +290,7 @@ exports.getActionVersion = getActionVersion;
async function createStatusReportBase(actionName, status, actionStartedAt, cause, exception) {
const commitOid = (0, exports.getOptionalInput)("sha") || process.env["GITHUB_SHA"] || "";
const ref = await getRef();
const jobRunUUID = process.env[sharedEnv.JOB_RUN_UUID] || "";
const workflowRunID = (0, workflow_1.getWorkflowRunID)();
const workflowRunAttempt = (0, workflow_1.getWorkflowRunAttempt)();
const workflowName = process.env["GITHUB_WORKFLOW"] || "";
@ -310,6 +311,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
core.exportVariable(sharedEnv.CODEQL_ACTION_TESTING_ENVIRONMENT, testingEnvironment);
}
const statusReport = {
job_run_uuid: jobRunUUID,
workflow_run_id: workflowRunID,
workflow_run_attempt: workflowRunAttempt,
workflow_name: workflowName,
@ -340,7 +342,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
status === "user-error") {
statusReport.completed_at = new Date().toISOString();
}
const matrix = getRequiredInput("matrix");
const matrix = (0, exports.getRequiredInput)("matrix");
if (matrix) {
statusReport.matrix_vars = matrix;
}