mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
Hide deprecation warning if feature flag is not set
This commit is contained in:
9
lib/upload-lib.js
generated
9
lib/upload-lib.js
generated
@@ -109,7 +109,10 @@ function areAllRunsUnique(sarifObjects) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function showCombineSarifFilesDeprecationWarning(sarifObjects) {
|
||||
async function showCombineSarifFilesDeprecationWarning(sarifObjects, features) {
|
||||
if (!(await features.getValue(feature_flags_1.Feature.CombineSarifFilesDeprecationWarning))) {
|
||||
return false;
|
||||
}
|
||||
// Only give a deprecation warning when not all runs are unique
|
||||
return (!areAllRunsUnique(sarifObjects) &&
|
||||
!process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING);
|
||||
@@ -128,7 +131,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
});
|
||||
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
|
||||
logger.debug("Not all SARIF files were produced by CodeQL. Merging files in the action.");
|
||||
if (showCombineSarifFilesDeprecationWarning(sarifObjects)) {
|
||||
if (await showCombineSarifFilesDeprecationWarning(sarifObjects, features)) {
|
||||
logger.warning("Uploading multiple SARIF runs with the same category is deprecated and will be removed on June 4, 2025. Please update your workflow to upload a single run per category. For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-deprecation-notice");
|
||||
core.exportVariable("CODEQL_MERGE_SARIF_DEPRECATION_WARNING", "true");
|
||||
}
|
||||
@@ -159,7 +162,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
}
|
||||
if (!(await codeQL.supportsFeature(tools_features_1.ToolsFeature.SarifMergeRunsFromEqualCategory))) {
|
||||
logger.warning("The CodeQL CLI does not support merging SARIF files. Merging files in the action.");
|
||||
if (showCombineSarifFilesDeprecationWarning(sarifObjects)) {
|
||||
if (await showCombineSarifFilesDeprecationWarning(sarifObjects, features)) {
|
||||
logger.warning("Uploading multiple CodeQL runs with the same category is deprecated and will be removed on June 4, 2025. Please update your CodeQL CLI version or update your workflow to set a distinct category for each CodeQL run. For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-deprecation-notice");
|
||||
core.exportVariable("CODEQL_MERGE_SARIF_DEPRECATION_WARNING", "true");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user