mirror of
https://github.com/github/codeql-action.git
synced 2026-04-02 01:32:17 +00:00
Update to log deprecation warning
Move rollout to April
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
43
lib/init-action.js
generated
43
lib/init-action.js
generated
@@ -109087,18 +109087,38 @@ function cleanupDatabaseClusterDirectory(config, logger, options = {}, rmSync2 =
|
||||
}
|
||||
async function getFileCoverageInformationEnabled(debugMode, codeql, features, repositoryProperties) {
|
||||
if (debugMode) {
|
||||
return { enabled: true, enabledByRepositoryProperty: false };
|
||||
return {
|
||||
enabled: true,
|
||||
enabledByRepositoryProperty: false,
|
||||
showDeprecationWarning: false
|
||||
};
|
||||
}
|
||||
if (!isAnalyzingPullRequest()) {
|
||||
return { enabled: true, enabledByRepositoryProperty: false };
|
||||
}
|
||||
if (!await features.getValue("skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */, codeql)) {
|
||||
return { enabled: true, enabledByRepositoryProperty: false };
|
||||
return {
|
||||
enabled: true,
|
||||
enabledByRepositoryProperty: false,
|
||||
showDeprecationWarning: false
|
||||
};
|
||||
}
|
||||
if (repositoryProperties["github-codeql-file-coverage-on-prs" /* FILE_COVERAGE_ON_PRS */] === true) {
|
||||
return { enabled: true, enabledByRepositoryProperty: true };
|
||||
return {
|
||||
enabled: true,
|
||||
enabledByRepositoryProperty: true,
|
||||
showDeprecationWarning: false
|
||||
};
|
||||
}
|
||||
return { enabled: false, enabledByRepositoryProperty: false };
|
||||
if (!await features.getValue("skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */, codeql)) {
|
||||
return {
|
||||
enabled: true,
|
||||
enabledByRepositoryProperty: false,
|
||||
showDeprecationWarning: true
|
||||
};
|
||||
}
|
||||
return {
|
||||
enabled: false,
|
||||
enabledByRepositoryProperty: false,
|
||||
showDeprecationWarning: false
|
||||
};
|
||||
}
|
||||
|
||||
// src/status-report.ts
|
||||
@@ -109767,6 +109787,15 @@ async function run(startedAt) {
|
||||
)
|
||||
);
|
||||
}
|
||||
if (fileCoverageResult.showDeprecationWarning && !process.env["CODEQL_ACTION_DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION" /* 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.'
|
||||
);
|
||||
core13.exportVariable(
|
||||
"CODEQL_ACTION_DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION" /* DID_LOG_FILE_COVERAGE_ON_PRS_DEPRECATION */,
|
||||
"true"
|
||||
);
|
||||
}
|
||||
await checkInstallPython311(config.languages, codeql);
|
||||
} catch (unwrappedError) {
|
||||
const error3 = wrapError(unwrappedError);
|
||||
|
||||
@@ -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",
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
@@ -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);
|
||||
|
||||
@@ -491,6 +493,7 @@ test.serial(
|
||||
);
|
||||
t.true(result.enabled);
|
||||
t.false(result.enabledByRepositoryProperty);
|
||||
t.true(result.showDeprecationWarning);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -509,6 +512,7 @@ test.serial(
|
||||
);
|
||||
t.true(result.enabled);
|
||||
t.true(result.enabledByRepositoryProperty);
|
||||
t.false(result.showDeprecationWarning);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -525,5 +529,6 @@ test.serial(
|
||||
);
|
||||
t.false(result.enabled);
|
||||
t.false(result.enabledByRepositoryProperty);
|
||||
t.false(result.showDeprecationWarning);
|
||||
},
|
||||
);
|
||||
|
||||
43
src/init.ts
43
src/init.ts
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user