Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update to log deprecation warning
Move rollout to April
  • Loading branch information
henrymercer committed Mar 10, 2026
commit bef08edf3221a5673c3202722c8817071010ae2a
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th

## [UNRELEASED]

- 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.
- Upcoming change: Starting April 2026, the CodeQL Action will skip collecting file coverage information on pull requests to improve analysis performance. File coverage information will still be computed on non-PR analyses. Pull request analyses will log a warning about this upcoming change.

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)
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). [#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)

Expand Down
43 changes: 36 additions & 7 deletions lib/init-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export enum EnvVar {
/** Whether the init action has been run. */
INIT_ACTION_HAS_RUN = "CODEQL_ACTION_INIT_HAS_RUN",

/** Whether the deprecation warning for file coverage on PRs has been logged. */
DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION = "CODEQL_ACTION_DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION",

/** Whether the error for a deprecated version of the CodeQL Action was logged. */
LOG_VERSION_DEPRECATION = "CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION",

Expand Down
17 changes: 17 additions & 0 deletions src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,23 @@ async function run(startedAt: Date) {
);
}

if (
fileCoverageResult.showDeprecationWarning &&
!process.env[EnvVar.DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION]
) {
logger.warning(
"Starting April 2026, the CodeQL Action will skip 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.",
);
core.exportVariable(
EnvVar.DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION,
"true",
);
}

await checkInstallPython311(config.languages, codeql);
} catch (unwrappedError) {
const error = wrapError(unwrappedError);
Expand Down
7 changes: 6 additions & 1 deletion src/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ test("file coverage information enabled when debugMode is true", async (t) => {
);
t.true(result.enabled);
t.false(result.enabledByRepositoryProperty);
t.false(result.showDeprecationWarning);
});

test.serial(
Expand All @@ -475,11 +476,12 @@ test.serial(
);
t.true(result.enabled);
t.false(result.enabledByRepositoryProperty);
t.false(result.showDeprecationWarning);
},
);

test.serial(
"file coverage information enabled when feature flag is not enabled",
"file coverage information enabled when feature flag is not enabled, with deprecation warning",
async (t) => {
sinon.stub(actionsUtil, "isAnalyzingPullRequest").returns(true);

Expand All @@ -491,6 +493,7 @@ test.serial(
);
t.true(result.enabled);
t.false(result.enabledByRepositoryProperty);
t.true(result.showDeprecationWarning);
},
);

Expand All @@ -509,6 +512,7 @@ test.serial(
);
t.true(result.enabled);
t.true(result.enabledByRepositoryProperty);
t.false(result.showDeprecationWarning);
},
);

Expand All @@ -525,5 +529,6 @@ test.serial(
);
t.false(result.enabled);
t.false(result.enabledByRepositoryProperty);
t.false(result.showDeprecationWarning);
},
);
43 changes: 33 additions & 10 deletions src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,29 +309,52 @@ export async function getFileCoverageInformationEnabled(
): Promise<{
enabled: boolean;
enabledByRepositoryProperty: boolean;
showDeprecationWarning: boolean;
}> {
// Always enable file coverage information in debug mode
if (debugMode) {
return { enabled: true, enabledByRepositoryProperty: false };
return {
enabled: true,
enabledByRepositoryProperty: false,
showDeprecationWarning: false,
};
}
// We're most interested in speeding up PRs, and we want to keep
// submitting file coverage information for the default branch since
// it is used to populate the status page.
if (!isAnalyzingPullRequest()) {
return { enabled: true, enabledByRepositoryProperty: false };
}
// If the feature is disabled, then maintain the previous behavior of
// unconditionally computing file coverage information.
if (!(await features.getValue(Feature.SkipFileCoverageOnPrs, codeql))) {
return { enabled: true, enabledByRepositoryProperty: false };
return {
enabled: true,
enabledByRepositoryProperty: false,
showDeprecationWarning: false,
};
}
// Allow repositories to opt in to file coverage information on PRs
// using a repository property.
// using a repository property. In this case, don't show the deprecation
// warning since the repository has explicitly opted in.
if (
repositoryProperties[RepositoryPropertyName.FILE_COVERAGE_ON_PRS] === true
) {
return { enabled: true, enabledByRepositoryProperty: true };
return {
enabled: true,
enabledByRepositoryProperty: true,
showDeprecationWarning: false,
};
}
// If the feature is disabled, then maintain the previous behavior of
// unconditionally computing file coverage information, but warn that
// file coverage on PRs will be disabled in a future release.
if (!(await features.getValue(Feature.SkipFileCoverageOnPrs, codeql))) {
return {
enabled: true,
enabledByRepositoryProperty: false,
showDeprecationWarning: true,
};
}
// Otherwise, disable file coverage information on PRs to speed up analysis.
return { enabled: false, enabledByRepositoryProperty: false };
return {
enabled: false,
enabledByRepositoryProperty: false,
showDeprecationWarning: false,
};
}