mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
Determine CodeQL version from feature flags on GHEC-DR
This commit is contained in:
16
lib/upload-lib.js
generated
16
lib/upload-lib.js
generated
@@ -86348,17 +86348,17 @@ function getAuthorizationHeaderFor(logger, apiDetails, url2) {
|
||||
var cachedGitHubVersion = void 0;
|
||||
async function getGitHubVersionFromApi(apiClient, apiDetails) {
|
||||
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
|
||||
return { type: 0 /* DOTCOM */ };
|
||||
return { type: "GitHub.com" /* DOTCOM */ };
|
||||
}
|
||||
const response = await apiClient.rest.meta.get();
|
||||
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === void 0) {
|
||||
return { type: 0 /* DOTCOM */ };
|
||||
return { type: "GitHub.com" /* DOTCOM */ };
|
||||
}
|
||||
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
|
||||
return { type: 2 /* GHE_DOTCOM */ };
|
||||
return { type: "GHEC-DR" /* GHE_DOTCOM */ };
|
||||
}
|
||||
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
|
||||
return { type: 1 /* GHES */, version };
|
||||
return { type: "GHES" /* GHES */, version };
|
||||
}
|
||||
async function getGitHubVersion() {
|
||||
if (cachedGitHubVersion === void 0) {
|
||||
@@ -87977,7 +87977,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
||||
toolsVersion: cliVersion2 ?? humanReadableVersion
|
||||
};
|
||||
}
|
||||
if (variant !== 0 /* DOTCOM */ && !forceShippedTools && !toolsInput) {
|
||||
if (variant === "GHES" /* GHES */ && !forceShippedTools && !toolsInput) {
|
||||
const result = await findOverridingToolsInCache(
|
||||
humanReadableVersion,
|
||||
logger
|
||||
@@ -90031,7 +90031,7 @@ function areAllRunsUnique(sarifObjects) {
|
||||
return true;
|
||||
}
|
||||
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
|
||||
if (githubVersion.type === 1 /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
|
||||
if (githubVersion.type === "GHES" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
|
||||
return false;
|
||||
}
|
||||
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
|
||||
@@ -90046,7 +90046,7 @@ async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
|
||||
);
|
||||
}
|
||||
async function shouldDisableCombineSarifFiles(sarifObjects, githubVersion) {
|
||||
if (githubVersion.type === 1 /* GHES */) {
|
||||
if (githubVersion.type === "GHES" /* GHES */) {
|
||||
if (satisfiesGHESVersion(githubVersion.version, "<3.18", true)) {
|
||||
return false;
|
||||
}
|
||||
@@ -90061,7 +90061,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
const sarifObjects = sarifFiles.map((sarifFile) => {
|
||||
return JSON.parse(fs11.readFileSync(sarifFile, "utf8"));
|
||||
});
|
||||
const deprecationWarningMessage = gitHubVersion.type === 1 /* GHES */ ? "and will be removed in GitHub Enterprise Server 3.18" : "and will be removed in July 2025";
|
||||
const deprecationWarningMessage = gitHubVersion.type === "GHES" /* GHES */ ? "and will be removed in GitHub Enterprise Server 3.18" : "and will be removed in July 2025";
|
||||
const deprecationMoreInformationMessage = "For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-from-a-single-upload";
|
||||
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
|
||||
await throwIfCombineSarifFilesDisabled(sarifObjects, gitHubVersion);
|
||||
|
||||
Reference in New Issue
Block a user