Add ability to override via repository property

This commit is contained in:
Henry Mercer
2026-03-09 17:06:22 +00:00
parent c102a6d8cd
commit 9e8c05933f
17 changed files with 61 additions and 4 deletions
+5
View File
@@ -5,6 +5,11 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
## [UNRELEASED] ## [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) - 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 when analyzing the default branch and protected branches.
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. [#TODO](https://github.com/github/codeql-action/pull/TODO)
## 4.32.6 - 05 Mar 2026 ## 4.32.6 - 05 Mar 2026
+1
View File
@@ -161733,6 +161733,7 @@ var semver2 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+1
View File
@@ -107232,6 +107232,7 @@ var semver2 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+1
View File
@@ -103786,6 +103786,7 @@ var semver2 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+1
View File
@@ -165100,6 +165100,7 @@ var semver2 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+9 -4
View File
@@ -104406,6 +104406,7 @@ function getUnknownLanguagesError(languages) {
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
function isString(value) { function isString(value) {
@@ -104422,7 +104423,8 @@ var booleanProperty = {
}; };
var repositoryPropertyParsers = { var repositoryPropertyParsers = {
["github-codeql-disable-overlay" /* DISABLE_OVERLAY */]: booleanProperty, ["github-codeql-disable-overlay" /* DISABLE_OVERLAY */]: booleanProperty,
["github-codeql-extra-queries" /* EXTRA_QUERIES */]: stringProperty ["github-codeql-extra-queries" /* EXTRA_QUERIES */]: stringProperty,
["github-codeql-file-coverage-on-prs" /* FILE_COVERAGE_ON_PRS */]: booleanProperty
}; };
async function loadPropertiesFromApi(gitHubVersion, logger, repositoryNwo) { async function loadPropertiesFromApi(gitHubVersion, logger, repositoryNwo) {
if (gitHubVersion.type === "GitHub Enterprise Server" /* GHES */) { if (gitHubVersion.type === "GitHub Enterprise Server" /* GHES */) {
@@ -109091,13 +109093,15 @@ function cleanupDatabaseClusterDirectory(config, logger, options = {}, rmSync2 =
} }
} }
} }
async function getFileCoverageInformationEnabled(debugMode, codeql, features) { async function getFileCoverageInformationEnabled(debugMode, codeql, features, repositoryProperties) {
return ( return (
// Always enable file coverage information in debug mode // Always enable file coverage information in debug mode
debugMode || // We're most interested in speeding up PRs, and we want to keep debugMode || // We're most interested in speeding up PRs, and we want to keep
// submitting file coverage information for the default branch since // submitting file coverage information for the default branch since
// it is used to populate the status page. // it is used to populate the status page.
!isAnalyzingPullRequest() || !await features.getValue("skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */, codeql) !isAnalyzingPullRequest() || // Allow repositories to opt in to file coverage information on PRs
// using a repository property.
repositoryProperties["github-codeql-file-coverage-on-prs" /* FILE_COVERAGE_ON_PRS */] === true || !await features.getValue("skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */, codeql)
); );
} }
@@ -109740,7 +109744,8 @@ async function run(startedAt) {
enableFileCoverageInformation: await getFileCoverageInformationEnabled( enableFileCoverageInformation: await getFileCoverageInformationEnabled(
debugMode, debugMode,
codeql, codeql,
features features,
repositoryPropertiesResult.orElse({})
), ),
logger logger
}); });
+1
View File
@@ -103785,6 +103785,7 @@ var semver2 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+1
View File
@@ -104781,6 +104781,7 @@ var semver5 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+1
View File
@@ -161368,6 +161368,7 @@ var semver2 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+1
View File
@@ -121388,6 +121388,7 @@ var semver5 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+1
View File
@@ -106826,6 +106826,7 @@ var semver2 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+1
View File
@@ -161518,6 +161518,7 @@ var semver2 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+1
View File
@@ -107572,6 +107572,7 @@ var semver5 = __toESM(require_semver2());
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => { var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay"; RepositoryPropertyName2["DISABLE_OVERLAY"] = "github-codeql-disable-overlay";
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries"; RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
RepositoryPropertyName2["FILE_COVERAGE_ON_PRS"] = "github-codeql-file-coverage-on-prs";
return RepositoryPropertyName2; return RepositoryPropertyName2;
})(RepositoryPropertyName || {}); })(RepositoryPropertyName || {});
var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set( var KNOWN_REPOSITORY_PROPERTY_NAMES = new Set(
+4
View File
@@ -9,12 +9,14 @@ import { GitHubVariant, GitHubVersion } from "../util";
export enum RepositoryPropertyName { export enum RepositoryPropertyName {
DISABLE_OVERLAY = "github-codeql-disable-overlay", DISABLE_OVERLAY = "github-codeql-disable-overlay",
EXTRA_QUERIES = "github-codeql-extra-queries", EXTRA_QUERIES = "github-codeql-extra-queries",
FILE_COVERAGE_ON_PRS = "github-codeql-file-coverage-on-prs",
} }
/** Parsed types of the known repository properties. */ /** Parsed types of the known repository properties. */
export type AllRepositoryProperties = { export type AllRepositoryProperties = {
[RepositoryPropertyName.DISABLE_OVERLAY]: boolean; [RepositoryPropertyName.DISABLE_OVERLAY]: boolean;
[RepositoryPropertyName.EXTRA_QUERIES]: string; [RepositoryPropertyName.EXTRA_QUERIES]: string;
[RepositoryPropertyName.FILE_COVERAGE_ON_PRS]: boolean;
}; };
/** Parsed repository properties. */ /** Parsed repository properties. */
@@ -24,6 +26,7 @@ export type RepositoryProperties = Partial<AllRepositoryProperties>;
export type RepositoryPropertyApiType = { export type RepositoryPropertyApiType = {
[RepositoryPropertyName.DISABLE_OVERLAY]: string; [RepositoryPropertyName.DISABLE_OVERLAY]: string;
[RepositoryPropertyName.EXTRA_QUERIES]: string; [RepositoryPropertyName.EXTRA_QUERIES]: string;
[RepositoryPropertyName.FILE_COVERAGE_ON_PRS]: string;
}; };
/** The type of functions which take the `value` from the API and try to convert it to the type we want. */ /** The type of functions which take the `value` from the API and try to convert it to the type we want. */
@@ -70,6 +73,7 @@ const repositoryPropertyParsers: {
} = { } = {
[RepositoryPropertyName.DISABLE_OVERLAY]: booleanProperty, [RepositoryPropertyName.DISABLE_OVERLAY]: booleanProperty,
[RepositoryPropertyName.EXTRA_QUERIES]: stringProperty, [RepositoryPropertyName.EXTRA_QUERIES]: stringProperty,
[RepositoryPropertyName.FILE_COVERAGE_ON_PRS]: booleanProperty,
}; };
/** /**
+1
View File
@@ -380,6 +380,7 @@ async function run(startedAt: Date) {
debugMode, debugMode,
codeql, codeql,
features, features,
repositoryPropertiesResult.orElse({}),
), ),
logger, logger,
}); });
+22
View File
@@ -457,6 +457,7 @@ test("file coverage information enabled when debugMode is true", async (t) => {
true, // debugMode true, // debugMode
createStubCodeQL({}), createStubCodeQL({}),
createFeatures([Feature.SkipFileCoverageOnPrs]), createFeatures([Feature.SkipFileCoverageOnPrs]),
{},
), ),
); );
}); });
@@ -471,6 +472,7 @@ test.serial(
false, // debugMode false, // debugMode
createStubCodeQL({}), createStubCodeQL({}),
createFeatures([Feature.SkipFileCoverageOnPrs]), createFeatures([Feature.SkipFileCoverageOnPrs]),
{},
), ),
); );
}, },
@@ -486,6 +488,25 @@ test.serial(
false, // debugMode false, // debugMode
createStubCodeQL({}), createStubCodeQL({}),
createFeatures([]), createFeatures([]),
{},
),
);
},
);
test.serial(
"file coverage information enabled when repository property is set",
async (t) => {
sinon.stub(actionsUtil, "isAnalyzingPullRequest").returns(true);
t.true(
await getFileCoverageInformationEnabled(
false, // debugMode
createStubCodeQL({}),
createFeatures([Feature.SkipFileCoverageOnPrs]),
{
"github-codeql-file-coverage-on-prs": true,
},
), ),
); );
}, },
@@ -501,6 +522,7 @@ test.serial(
false, // debugMode false, // debugMode
createStubCodeQL({}), createStubCodeQL({}),
createFeatures([Feature.SkipFileCoverageOnPrs]), createFeatures([Feature.SkipFileCoverageOnPrs]),
{},
), ),
); );
}, },
+9
View File
@@ -18,6 +18,10 @@ import {
Feature, Feature,
FeatureEnablement, FeatureEnablement,
} from "./feature-flags"; } from "./feature-flags";
import {
RepositoryProperties,
RepositoryPropertyName,
} from "./feature-flags/properties";
import { KnownLanguage, Language } from "./languages"; import { KnownLanguage, Language } from "./languages";
import { Logger, withGroupAsync } from "./logging"; import { Logger, withGroupAsync } from "./logging";
import { ToolsSource } from "./setup-codeql"; import { ToolsSource } from "./setup-codeql";
@@ -301,6 +305,7 @@ export async function getFileCoverageInformationEnabled(
debugMode: boolean, debugMode: boolean,
codeql: CodeQL, codeql: CodeQL,
features: FeatureEnablement, features: FeatureEnablement,
repositoryProperties: RepositoryProperties,
): Promise<boolean> { ): Promise<boolean> {
return ( return (
// Always enable file coverage information in debug mode // Always enable file coverage information in debug mode
@@ -309,6 +314,10 @@ export async function getFileCoverageInformationEnabled(
// submitting file coverage information for the default branch since // submitting file coverage information for the default branch since
// it is used to populate the status page. // it is used to populate the status page.
!isAnalyzingPullRequest() || !isAnalyzingPullRequest() ||
// Allow repositories to opt in to file coverage information on PRs
// using a repository property.
repositoryProperties[RepositoryPropertyName.FILE_COVERAGE_ON_PRS] ===
true ||
!(await features.getValue(Feature.SkipFileCoverageOnPrs, codeql)) !(await features.getValue(Feature.SkipFileCoverageOnPrs, codeql))
); );
} }