diff --git a/CHANGELOG.md b/CHANGELOG.md index e6e88d35e..b6a424914 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,13 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th ## [UNRELEASED] -- Fixed [a bug](https://github.com/github/codeql-action/issues/3555) which caused the CodeQL Action to fail loading repository properties if a "Multi select" repository property was configured for the repository. [#3557](https://github.com/github/codeql-action/pull/3557) - Added an experimental change which skips collecting file coverage information on pull requests to improve analysis performance. File coverage information will still be computed on non-PR analyses. Repositories owned by an organization can opt out of this change by creating a custom repository property with the name `github-codeql-file-coverage-on-prs` and the type "True/false", then setting this property to `true` in the repository's settings. For more information, see [Managing custom properties for repositories in your organization](https://docs.github.com/en/organizations/managing-organization-settings/managing-custom-properties-for-repositories-in-your-organization). We expect to roll this change out to everyone in March. [#3562](https://github.com/github/codeql-action/pull/3562) +- Fixed [a bug](https://github.com/github/codeql-action/issues/3555) which caused the CodeQL Action to fail loading repository properties if a "Multi select" repository property was configured for the repository. [#3557](https://github.com/github/codeql-action/pull/3557) +- The CodeQL Action now loads [custom repository properties](https://docs.github.com/en/organizations/managing-organization-settings/managing-custom-properties-for-repositories-in-your-organization) on GitHub Enterprise Server, enabling the customization of features such as `github-codeql-disable-overlay` that was previously only available on GitHub.com. [#3559](https://github.com/github/codeql-action/pull/3559) ## 4.32.6 - 05 Mar 2026 diff --git a/eslint.config.mjs b/eslint.config.mjs index 6ac800276..97e15194e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -161,6 +161,7 @@ export default [ "@typescript-eslint/no-unused-vars": [ "error", { + "args": "all", "argsIgnorePattern": "^_", } ], diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index 46bfde5b0..48566462a 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -162241,11 +162241,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", diff --git a/lib/analyze-action.js b/lib/analyze-action.js index f83b1ac07..bc2af128c 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -107990,11 +107990,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", @@ -112463,10 +112458,7 @@ function areAllRunsUnique(sarifLogs) { // src/upload-lib.ts var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning."; var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository."; -async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) { - if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) { - return false; - } +async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) { return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING; } async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) { @@ -112499,10 +112491,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo logger.debug( "Not all SARIF files were produced by CodeQL. Merging files in the action." ); - if (await shouldShowCombineSarifFilesDeprecationWarning( - sarifObjects, - gitHubVersion - )) { + if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) { logger.warning( `Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}` ); diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 482b85ff0..972464310 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -104290,11 +104290,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", diff --git a/lib/init-action-post.js b/lib/init-action-post.js index aabc7baae..5b2a57e83 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -165727,11 +165727,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", @@ -169553,10 +169548,7 @@ function areAllRunsUnique(sarifLogs) { // src/upload-lib.ts var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning."; var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository."; -async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) { - if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) { - return false; - } +async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) { return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING; } async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) { @@ -169589,10 +169581,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo logger.debug( "Not all SARIF files were produced by CodeQL. Merging files in the action." ); - if (await shouldShowCombineSarifFilesDeprecationWarning( - sarifObjects, - gitHubVersion - )) { + if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) { logger.warning( `Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}` ); diff --git a/lib/init-action.js b/lib/init-action.js index 34b9335f5..f5d4caece 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -104426,10 +104426,7 @@ var repositoryPropertyParsers = { ["github-codeql-extra-queries" /* EXTRA_QUERIES */]: stringProperty, ["github-codeql-file-coverage-on-prs" /* FILE_COVERAGE_ON_PRS */]: booleanProperty }; -async function loadPropertiesFromApi(gitHubVersion, logger, repositoryNwo) { - if (gitHubVersion.type === "GitHub Enterprise Server" /* GHES */) { - return {}; - } +async function loadPropertiesFromApi(logger, repositoryNwo) { try { const response = await getRepositoryProperties(repositoryNwo); const remoteProperties = response.data; @@ -105551,11 +105548,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", @@ -109651,8 +109643,6 @@ async function run(startedAt) { ); const repositoryPropertiesResult = await loadRepositoryProperties( repositoryNwo, - gitHubVersion, - features, logger ); const jobRunUuid = v4_default(); @@ -110065,7 +110055,7 @@ exec ${goBinaryPath} "$@"` logger ); } -async function loadRepositoryProperties(repositoryNwo, gitHubVersion, features, logger) { +async function loadRepositoryProperties(repositoryNwo, logger) { const repositoryOwnerType = github2.context.payload.repository?.owner.type; logger.debug( `Repository owner type is '${repositoryOwnerType ?? "unknown"}'.` @@ -110076,16 +110066,8 @@ async function loadRepositoryProperties(repositoryNwo, gitHubVersion, features, ); return new Success({}); } - if (!await features.getValue("use_repository_properties_v2" /* UseRepositoryProperties */)) { - logger.debug( - "Skipping loading repository properties because the UseRepositoryProperties feature flag is disabled." - ); - return new Success({}); - } try { - return new Success( - await loadPropertiesFromApi(gitHubVersion, logger, repositoryNwo) - ); + return new Success(await loadPropertiesFromApi(logger, repositoryNwo)); } catch (error3) { logger.warning( `Failed to load repository properties: ${getErrorMessage(error3)}` diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index 854dc9de4..f4fe15e31 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -104281,11 +104281,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index 3a1825ec5..a4d9f713d 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -104177,11 +104177,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", diff --git a/lib/start-proxy-action-post.js b/lib/start-proxy-action-post.js index 4b36497cb..3bbd51bab 100644 --- a/lib/start-proxy-action-post.js +++ b/lib/start-proxy-action-post.js @@ -161647,11 +161647,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 4c88bab59..d678b0191 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -120969,11 +120969,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", diff --git a/lib/upload-lib.js b/lib/upload-lib.js index ad0a615df..026d90478 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -107437,11 +107437,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", @@ -110350,10 +110345,7 @@ function areAllRunsUnique(sarifLogs) { // src/upload-lib.ts var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning."; var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository."; -async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) { - if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) { - return false; - } +async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) { return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING; } async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) { @@ -110386,10 +110378,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo logger.debug( "Not all SARIF files were produced by CodeQL. Merging files in the action." ); - if (await shouldShowCombineSarifFilesDeprecationWarning( - sarifObjects, - gitHubVersion - )) { + if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) { logger.warning( `Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}` ); diff --git a/lib/upload-sarif-action-post.js b/lib/upload-sarif-action-post.js index d8915fb49..4cee33261 100644 --- a/lib/upload-sarif-action-post.js +++ b/lib/upload-sarif-action-post.js @@ -161809,11 +161809,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 3f97ab020..af286f4dd 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -107150,11 +107150,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */ }, - ["use_repository_properties_v2" /* UseRepositoryProperties */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: void 0 - }, ["validate_db_config" /* ValidateDbConfig */]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", @@ -110942,10 +110937,7 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe // src/upload-lib.ts var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning."; var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository."; -async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) { - if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) { - return false; - } +async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) { return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING; } async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) { @@ -110978,10 +110970,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo logger.debug( "Not all SARIF files were produced by CodeQL. Merging files in the action." ); - if (await shouldShowCombineSarifFilesDeprecationWarning( - sarifObjects, - gitHubVersion - )) { + if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) { logger.warning( `Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}` ); diff --git a/src/feature-flags.ts b/src/feature-flags.ts index af192ed7d..c65f683be 100644 --- a/src/feature-flags.ts +++ b/src/feature-flags.ts @@ -87,7 +87,6 @@ export enum Feature { StartProxyRemoveUnusedRegistries = "start_proxy_remove_unused_registries", StartProxyUseFeaturesRelease = "start_proxy_use_features_release", UploadOverlayDbToApi = "upload_overlay_db_to_api", - UseRepositoryProperties = "use_repository_properties_v2", ValidateDbConfig = "validate_db_config", } @@ -349,11 +348,6 @@ export const featureConfig = { minimumVersion: undefined, toolsFeature: ToolsFeature.BundleSupportsOverlay, }, - [Feature.UseRepositoryProperties]: { - defaultValue: false, - envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES", - minimumVersion: undefined, - }, [Feature.ValidateDbConfig]: { defaultValue: false, envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG", diff --git a/src/feature-flags/properties.test.ts b/src/feature-flags/properties.test.ts index c820f8d00..a468b3349 100644 --- a/src/feature-flags/properties.test.ts +++ b/src/feature-flags/properties.test.ts @@ -5,7 +5,6 @@ import * as api from "../api-client"; import { getRunnerLogger } from "../logging"; import { parseRepositoryNwo } from "../repository"; import { setupTests } from "../testing-utils"; -import * as util from "../util"; import * as properties from "./properties"; @@ -23,13 +22,7 @@ test.serial( const logger = getRunnerLogger(true); const mockRepositoryNwo = parseRepositoryNwo("owner/repo"); await t.throwsAsync( - properties.loadPropertiesFromApi( - { - type: util.GitHubVariant.DOTCOM, - }, - logger, - mockRepositoryNwo, - ), + properties.loadPropertiesFromApi(logger, mockRepositoryNwo), { message: /Expected repository properties API to return an array/, }, @@ -49,13 +42,7 @@ test.serial( const logger = getRunnerLogger(true); const mockRepositoryNwo = parseRepositoryNwo("owner/repo"); await t.throwsAsync( - properties.loadPropertiesFromApi( - { - type: util.GitHubVariant.DOTCOM, - }, - logger, - mockRepositoryNwo, - ), + properties.loadPropertiesFromApi(logger, mockRepositoryNwo), { message: /Expected repository property object to have a 'property_name'/, @@ -79,43 +66,11 @@ test.serial( const logger = getRunnerLogger(true); const mockRepositoryNwo = parseRepositoryNwo("owner/repo"); await t.notThrowsAsync( - properties.loadPropertiesFromApi( - { - type: util.GitHubVariant.DOTCOM, - }, - logger, - mockRepositoryNwo, - ), + properties.loadPropertiesFromApi(logger, mockRepositoryNwo), ); }, ); -test.serial( - "loadPropertiesFromApi returns empty object if on GHES", - async (t) => { - sinon.stub(api, "getRepositoryProperties").resolves({ - headers: {}, - status: 200, - url: "", - data: [ - { property_name: "github-codeql-extra-queries", value: "+queries" }, - { property_name: "unknown-property", value: "something" }, - ] satisfies properties.GitHubPropertiesResponse, - }); - const logger = getRunnerLogger(true); - const mockRepositoryNwo = parseRepositoryNwo("owner/repo"); - const response = await properties.loadPropertiesFromApi( - { - type: util.GitHubVariant.GHES, - version: "", - }, - logger, - mockRepositoryNwo, - ); - t.deepEqual(response, {}); - }, -); - test.serial("loadPropertiesFromApi loads known properties", async (t) => { sinon.stub(api, "getRepositoryProperties").resolves({ headers: {}, @@ -129,9 +84,6 @@ test.serial("loadPropertiesFromApi loads known properties", async (t) => { const logger = getRunnerLogger(true); const mockRepositoryNwo = parseRepositoryNwo("owner/repo"); const response = await properties.loadPropertiesFromApi( - { - type: util.GitHubVariant.DOTCOM, - }, logger, mockRepositoryNwo, ); @@ -155,9 +107,6 @@ test.serial("loadPropertiesFromApi parses true boolean property", async (t) => { const warningSpy = sinon.spy(logger, "warning"); const mockRepositoryNwo = parseRepositoryNwo("owner/repo"); const response = await properties.loadPropertiesFromApi( - { - type: util.GitHubVariant.DOTCOM, - }, logger, mockRepositoryNwo, ); @@ -186,9 +135,6 @@ test.serial( const warningSpy = sinon.spy(logger, "warning"); const mockRepositoryNwo = parseRepositoryNwo("owner/repo"); const response = await properties.loadPropertiesFromApi( - { - type: util.GitHubVariant.DOTCOM, - }, logger, mockRepositoryNwo, ); @@ -211,13 +157,7 @@ test.serial( const logger = getRunnerLogger(true); const mockRepositoryNwo = parseRepositoryNwo("owner/repo"); await t.throwsAsync( - properties.loadPropertiesFromApi( - { - type: util.GitHubVariant.DOTCOM, - }, - logger, - mockRepositoryNwo, - ), + properties.loadPropertiesFromApi(logger, mockRepositoryNwo), { message: /Unexpected value for repository property 'github-codeql-extra-queries' \(number\), got: 123/, @@ -244,9 +184,6 @@ test.serial( const warningSpy = sinon.spy(logger, "warning"); const mockRepositoryNwo = parseRepositoryNwo("owner/repo"); const response = await properties.loadPropertiesFromApi( - { - type: util.GitHubVariant.DOTCOM, - }, logger, mockRepositoryNwo, ); diff --git a/src/feature-flags/properties.ts b/src/feature-flags/properties.ts index 9245f7ece..8f52e6d9a 100644 --- a/src/feature-flags/properties.ts +++ b/src/feature-flags/properties.ts @@ -1,7 +1,6 @@ import { getRepositoryProperties } from "../api-client"; import { Logger } from "../logging"; import { RepositoryNwo } from "../repository"; -import { GitHubVariant, GitHubVersion } from "../util"; /** * Enumerates repository property names that have some meaning to us. @@ -97,16 +96,9 @@ export type GitHubPropertiesResponse = GitHubRepositoryProperty[]; * @returns Returns a partial mapping from `RepositoryPropertyName` to values. */ export async function loadPropertiesFromApi( - gitHubVersion: GitHubVersion, logger: Logger, repositoryNwo: RepositoryNwo, ): Promise { - // TODO: To be safe for now; later we should replace this with a version check once we know - // which version of GHES we expect this to be supported by. - if (gitHubVersion.type === GitHubVariant.GHES) { - return {}; - } - try { const response = await getRepositoryProperties(repositoryNwo); const remoteProperties = response.data as GitHubPropertiesResponse; diff --git a/src/init-action.ts b/src/init-action.ts index 577292ecd..6ca8d0c97 100644 --- a/src/init-action.ts +++ b/src/init-action.ts @@ -93,7 +93,6 @@ import { checkActionVersion, getErrorMessage, BuildMode, - GitHubVersion, Result, getOptionalEnvVar, Success, @@ -250,8 +249,6 @@ async function run(startedAt: Date) { // Fetch the values of known repository properties that affect us. const repositoryPropertiesResult = await loadRepositoryProperties( repositoryNwo, - gitHubVersion, - features, logger, ); @@ -835,8 +832,6 @@ async function run(startedAt: Date) { */ async function loadRepositoryProperties( repositoryNwo: RepositoryNwo, - gitHubVersion: GitHubVersion, - features: FeatureEnablement, logger: Logger, ): Promise> { // See if we can skip loading repository properties early. In particular, @@ -854,17 +849,8 @@ async function loadRepositoryProperties( return new Success({}); } - if (!(await features.getValue(Feature.UseRepositoryProperties))) { - logger.debug( - "Skipping loading repository properties because the UseRepositoryProperties feature flag is disabled.", - ); - return new Success({}); - } - try { - return new Success( - await loadPropertiesFromApi(gitHubVersion, logger, repositoryNwo), - ); + return new Success(await loadPropertiesFromApi(logger, repositoryNwo)); } catch (error) { logger.warning( `Failed to load repository properties: ${getErrorMessage(error)}`, diff --git a/src/status-report.ts b/src/status-report.ts index cdb96356e..7cda9c234 100644 --- a/src/status-report.ts +++ b/src/status-report.ts @@ -356,7 +356,6 @@ export async function createStatusReportBase( statusReport.matrix_vars = matrix; } if ("RUNNER_ARCH" in process.env) { - // RUNNER_ARCH is available only in GHES 3.4 and later // Values other than X86, X64, ARM, or ARM64 are discarded server side statusReport.runner_arch = process.env["RUNNER_ARCH"]; } diff --git a/src/upload-lib.test.ts b/src/upload-lib.test.ts index 92dc2e773..e1990a811 100644 --- a/src/upload-lib.test.ts +++ b/src/upload-lib.test.ts @@ -631,57 +631,10 @@ test.serial( "shouldShowCombineSarifFilesDeprecationWarning when on dotcom", async (t) => { t.true( - await uploadLib.shouldShowCombineSarifFilesDeprecationWarning( - [createMockSarif("abc", "def"), createMockSarif("abc", "def")], - { - type: GitHubVariant.DOTCOM, - }, - ), - ); - }, -); - -test.serial( - "shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.13", - async (t) => { - t.false( - await uploadLib.shouldShowCombineSarifFilesDeprecationWarning( - [createMockSarif("abc", "def"), createMockSarif("abc", "def")], - { - type: GitHubVariant.GHES, - version: "3.13.2", - }, - ), - ); - }, -); - -test.serial( - "shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.14", - async (t) => { - t.true( - await uploadLib.shouldShowCombineSarifFilesDeprecationWarning( - [createMockSarif("abc", "def"), createMockSarif("abc", "def")], - { - type: GitHubVariant.GHES, - version: "3.14.0", - }, - ), - ); - }, -); - -test.serial( - "shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.16 pre", - async (t) => { - t.true( - await uploadLib.shouldShowCombineSarifFilesDeprecationWarning( - [createMockSarif("abc", "def"), createMockSarif("abc", "def")], - { - type: GitHubVariant.GHES, - version: "3.16.0.pre1", - }, - ), + await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([ + createMockSarif("abc", "def"), + createMockSarif("abc", "def"), + ]), ); }, ); @@ -690,12 +643,9 @@ test.serial( "shouldShowCombineSarifFilesDeprecationWarning with only 1 run", async (t) => { t.false( - await uploadLib.shouldShowCombineSarifFilesDeprecationWarning( - [createMockSarif("abc", "def")], - { - type: GitHubVariant.DOTCOM, - }, - ), + await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([ + createMockSarif("abc", "def"), + ]), ); }, ); @@ -704,12 +654,10 @@ test.serial( "shouldShowCombineSarifFilesDeprecationWarning with distinct categories", async (t) => { t.false( - await uploadLib.shouldShowCombineSarifFilesDeprecationWarning( - [createMockSarif("abc", "def"), createMockSarif("def", "def")], - { - type: GitHubVariant.DOTCOM, - }, - ), + await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([ + createMockSarif("abc", "def"), + createMockSarif("def", "def"), + ]), ); }, ); @@ -718,12 +666,10 @@ test.serial( "shouldShowCombineSarifFilesDeprecationWarning with distinct tools", async (t) => { t.false( - await uploadLib.shouldShowCombineSarifFilesDeprecationWarning( - [createMockSarif("abc", "abc"), createMockSarif("abc", "def")], - { - type: GitHubVariant.DOTCOM, - }, - ), + await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([ + createMockSarif("abc", "abc"), + createMockSarif("abc", "def"), + ]), ); }, ); @@ -734,12 +680,10 @@ test.serial( process.env["CODEQL_MERGE_SARIF_DEPRECATION_WARNING"] = "true"; t.false( - await uploadLib.shouldShowCombineSarifFilesDeprecationWarning( - [createMockSarif("abc", "def"), createMockSarif("abc", "def")], - { - type: GitHubVariant.DOTCOM, - }, - ), + await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([ + createMockSarif("abc", "def"), + createMockSarif("abc", "def"), + ]), ); }, ); @@ -759,18 +703,6 @@ test.serial("throwIfCombineSarifFilesDisabled when on dotcom", async (t) => { ); }); -test.serial("throwIfCombineSarifFilesDisabled when on GHES 3.13", async (t) => { - await t.notThrowsAsync( - uploadLib.throwIfCombineSarifFilesDisabled( - [createMockSarif("abc", "def"), createMockSarif("abc", "def")], - { - type: GitHubVariant.GHES, - version: "3.13.2", - }, - ), - ); -}); - test.serial("throwIfCombineSarifFilesDisabled when on GHES 3.14", async (t) => { await t.notThrowsAsync( uploadLib.throwIfCombineSarifFilesDisabled( diff --git a/src/upload-lib.ts b/src/upload-lib.ts index 249882533..101e7946f 100644 --- a/src/upload-lib.ts +++ b/src/upload-lib.ts @@ -47,16 +47,7 @@ const GENERIC_404_MSG = // Checks whether the deprecation warning for combining SARIF files should be shown. export async function shouldShowCombineSarifFilesDeprecationWarning( sarifObjects: Array>, - githubVersion: GitHubVersion, ) { - // Do not show this warning on GHES versions before 3.14.0 - if ( - githubVersion.type === GitHubVariant.GHES && - satisfiesGHESVersion(githubVersion.version, "<3.14", true) - ) { - return false; - } - // Only give a deprecation warning when not all runs are unique and // we haven't already shown the warning. return ( @@ -131,12 +122,7 @@ async function combineSarifFilesUsingCLI( "Not all SARIF files were produced by CodeQL. Merging files in the action.", ); - if ( - await shouldShowCombineSarifFilesDeprecationWarning( - sarifObjects, - gitHubVersion, - ) - ) { + if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) { logger.warning( `Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`, );