add first_party_analysis boolean to all status reports

This commit is contained in:
nickfyson
2024-02-01 16:02:52 +00:00
parent 592977e6ae
commit a7dc229496
15 changed files with 126 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ import * as safeWhich from "@chrisgavin/safe-which";
import { JSONSchemaForNPMPackageJsonFiles } from "@schemastore/package";
import type { Config } from "./config-utils";
import { EnvVar } from "./environment";
import {
doesDirectoryExist,
getCodeQLDatabasePath,
@@ -259,6 +260,17 @@ export function getActionVersion(): string {
return pkg.version!;
}
/**
* @returns a boolean indicating whether the analysis is considered to be first party.
*
* This is based on whether the init action has been used, which is only used for first party analysis.
* When a SARIF file has been generated by other means and submitted using the upload action, this is
* considered to be a third party analysis and is treated differently when calculating SLOs.
*/
export function isFirstPartyAnalysis(): boolean {
return process.env[EnvVar.INIT_ACTION_HAS_RUN] === "true";
}
/**
* Returns the name of the event that triggered this workflow.
*