Skip to content

Commit bef08ed

Browse files
committed
Update to log deprecation warning
Move rollout to April
1 parent ce321da commit bef08ed

File tree

6 files changed

+97
-22
lines changed

6 files changed

+97
-22
lines changed

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
44

55
## [UNRELEASED]
66

7-
- 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.
7+
- 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.
88

9-
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).
10-
11-
We expect to roll this change out to everyone in March. [#3562](https://github.com/github/codeql-action/pull/3562)
9+
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)
1210
- 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)
1311
- 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)
1412

lib/init-action.js

Lines changed: 36 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/environment.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ export enum EnvVar {
4747
/** Whether the init action has been run. */
4848
INIT_ACTION_HAS_RUN = "CODEQL_ACTION_INIT_HAS_RUN",
4949

50+
/** Whether the deprecation warning for file coverage on PRs has been logged. */
51+
DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION = "CODEQL_ACTION_DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION",
52+
5053
/** Whether the error for a deprecated version of the CodeQL Action was logged. */
5154
LOG_VERSION_DEPRECATION = "CODEQL_ACTION_DID_LOG_VERSION_DEPRECATION",
5255

src/init-action.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,23 @@ async function run(startedAt: Date) {
409409
);
410410
}
411411

412+
if (
413+
fileCoverageResult.showDeprecationWarning &&
414+
!process.env[EnvVar.DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION]
415+
) {
416+
logger.warning(
417+
"Starting April 2026, the CodeQL Action will skip collecting file coverage information on pull requests " +
418+
"to improve analysis performance. File coverage information will still be computed on non-PR analyses. " +
419+
"Repositories owned by an organization can opt out of this change by creating a custom repository property " +
420+
'with the name `github-codeql-file-coverage-on-prs` and the type "True/false", then setting this property to ' +
421+
"`true` in the repository's settings.",
422+
);
423+
core.exportVariable(
424+
EnvVar.DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION,
425+
"true",
426+
);
427+
}
428+
412429
await checkInstallPython311(config.languages, codeql);
413430
} catch (unwrappedError) {
414431
const error = wrapError(unwrappedError);

src/init.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ test("file coverage information enabled when debugMode is true", async (t) => {
460460
);
461461
t.true(result.enabled);
462462
t.false(result.enabledByRepositoryProperty);
463+
t.false(result.showDeprecationWarning);
463464
});
464465

465466
test.serial(
@@ -475,11 +476,12 @@ test.serial(
475476
);
476477
t.true(result.enabled);
477478
t.false(result.enabledByRepositoryProperty);
479+
t.false(result.showDeprecationWarning);
478480
},
479481
);
480482

481483
test.serial(
482-
"file coverage information enabled when feature flag is not enabled",
484+
"file coverage information enabled when feature flag is not enabled, with deprecation warning",
483485
async (t) => {
484486
sinon.stub(actionsUtil, "isAnalyzingPullRequest").returns(true);
485487

@@ -491,6 +493,7 @@ test.serial(
491493
);
492494
t.true(result.enabled);
493495
t.false(result.enabledByRepositoryProperty);
496+
t.true(result.showDeprecationWarning);
494497
},
495498
);
496499

@@ -509,6 +512,7 @@ test.serial(
509512
);
510513
t.true(result.enabled);
511514
t.true(result.enabledByRepositoryProperty);
515+
t.false(result.showDeprecationWarning);
512516
},
513517
);
514518

@@ -525,5 +529,6 @@ test.serial(
525529
);
526530
t.false(result.enabled);
527531
t.false(result.enabledByRepositoryProperty);
532+
t.false(result.showDeprecationWarning);
528533
},
529534
);

src/init.ts

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -309,29 +309,52 @@ export async function getFileCoverageInformationEnabled(
309309
): Promise<{
310310
enabled: boolean;
311311
enabledByRepositoryProperty: boolean;
312+
showDeprecationWarning: boolean;
312313
}> {
313314
// Always enable file coverage information in debug mode
314315
if (debugMode) {
315-
return { enabled: true, enabledByRepositoryProperty: false };
316+
return {
317+
enabled: true,
318+
enabledByRepositoryProperty: false,
319+
showDeprecationWarning: false,
320+
};
316321
}
317322
// We're most interested in speeding up PRs, and we want to keep
318323
// submitting file coverage information for the default branch since
319324
// it is used to populate the status page.
320325
if (!isAnalyzingPullRequest()) {
321-
return { enabled: true, enabledByRepositoryProperty: false };
322-
}
323-
// If the feature is disabled, then maintain the previous behavior of
324-
// unconditionally computing file coverage information.
325-
if (!(await features.getValue(Feature.SkipFileCoverageOnPrs, codeql))) {
326-
return { enabled: true, enabledByRepositoryProperty: false };
326+
return {
327+
enabled: true,
328+
enabledByRepositoryProperty: false,
329+
showDeprecationWarning: false,
330+
};
327331
}
328332
// Allow repositories to opt in to file coverage information on PRs
329-
// using a repository property.
333+
// using a repository property. In this case, don't show the deprecation
334+
// warning since the repository has explicitly opted in.
330335
if (
331336
repositoryProperties[RepositoryPropertyName.FILE_COVERAGE_ON_PRS] === true
332337
) {
333-
return { enabled: true, enabledByRepositoryProperty: true };
338+
return {
339+
enabled: true,
340+
enabledByRepositoryProperty: true,
341+
showDeprecationWarning: false,
342+
};
343+
}
344+
// If the feature is disabled, then maintain the previous behavior of
345+
// unconditionally computing file coverage information, but warn that
346+
// file coverage on PRs will be disabled in a future release.
347+
if (!(await features.getValue(Feature.SkipFileCoverageOnPrs, codeql))) {
348+
return {
349+
enabled: true,
350+
enabledByRepositoryProperty: false,
351+
showDeprecationWarning: true,
352+
};
334353
}
335354
// Otherwise, disable file coverage information on PRs to speed up analysis.
336-
return { enabled: false, enabledByRepositoryProperty: false };
355+
return {
356+
enabled: false,
357+
enabledByRepositoryProperty: false,
358+
showDeprecationWarning: false,
359+
};
337360
}

0 commit comments

Comments
 (0)