Only show deprecation warning on GHES 3.14+
This commit is contained in:
parent
80394dcc32
commit
905f9b0083
3 changed files with 35 additions and 6 deletions
12
lib/upload-lib.js
generated
12
lib/upload-lib.js
generated
|
|
@ -33,6 +33,7 @@ const zlib_1 = __importDefault(require("zlib"));
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const file_url_1 = __importDefault(require("file-url"));
|
const file_url_1 = __importDefault(require("file-url"));
|
||||||
const jsonschema = __importStar(require("jsonschema"));
|
const jsonschema = __importStar(require("jsonschema"));
|
||||||
|
const semver = __importStar(require("semver"));
|
||||||
const actionsUtil = __importStar(require("./actions-util"));
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const actions_util_1 = require("./actions-util");
|
const actions_util_1 = require("./actions-util");
|
||||||
const api = __importStar(require("./api-client"));
|
const api = __importStar(require("./api-client"));
|
||||||
|
|
@ -109,10 +110,15 @@ function areAllRunsUnique(sarifObjects) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
async function showCombineSarifFilesDeprecationWarning(sarifObjects, features) {
|
async function showCombineSarifFilesDeprecationWarning(sarifObjects, features, githubVersion) {
|
||||||
if (!(await features.getValue(feature_flags_1.Feature.CombineSarifFilesDeprecationWarning))) {
|
if (!(await features.getValue(feature_flags_1.Feature.CombineSarifFilesDeprecationWarning))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Do not show this warning on GHES versions before 3.14.0
|
||||||
|
if (githubVersion.type === util_1.GitHubVariant.GHES &&
|
||||||
|
semver.lt(githubVersion.version, "3.14.0")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Only give a deprecation warning when not all runs are unique
|
// Only give a deprecation warning when not all runs are unique
|
||||||
return (!areAllRunsUnique(sarifObjects) &&
|
return (!areAllRunsUnique(sarifObjects) &&
|
||||||
!process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING);
|
!process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING);
|
||||||
|
|
@ -131,7 +137,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||||
});
|
});
|
||||||
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
|
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
|
||||||
logger.debug("Not all SARIF files were produced by CodeQL. Merging files in the action.");
|
logger.debug("Not all SARIF files were produced by CodeQL. Merging files in the action.");
|
||||||
if (await showCombineSarifFilesDeprecationWarning(sarifObjects, features)) {
|
if (await showCombineSarifFilesDeprecationWarning(sarifObjects, features, gitHubVersion)) {
|
||||||
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");
|
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");
|
core.exportVariable("CODEQL_MERGE_SARIF_DEPRECATION_WARNING", "true");
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +168,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||||
}
|
}
|
||||||
if (!(await codeQL.supportsFeature(tools_features_1.ToolsFeature.SarifMergeRunsFromEqualCategory))) {
|
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.");
|
logger.warning("The CodeQL CLI does not support merging SARIF files. Merging files in the action.");
|
||||||
if (await showCombineSarifFilesDeprecationWarning(sarifObjects, features)) {
|
if (await showCombineSarifFilesDeprecationWarning(sarifObjects, features, gitHubVersion)) {
|
||||||
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");
|
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");
|
core.exportVariable("CODEQL_MERGE_SARIF_DEPRECATION_WARNING", "true");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -6,6 +6,7 @@ import * as core from "@actions/core";
|
||||||
import { OctokitResponse } from "@octokit/types";
|
import { OctokitResponse } from "@octokit/types";
|
||||||
import fileUrl from "file-url";
|
import fileUrl from "file-url";
|
||||||
import * as jsonschema from "jsonschema";
|
import * as jsonschema from "jsonschema";
|
||||||
|
import * as semver from "semver";
|
||||||
|
|
||||||
import * as actionsUtil from "./actions-util";
|
import * as actionsUtil from "./actions-util";
|
||||||
import { getOptionalInput, getRequiredInput } from "./actions-util";
|
import { getOptionalInput, getRequiredInput } from "./actions-util";
|
||||||
|
|
@ -24,6 +25,7 @@ import * as util from "./util";
|
||||||
import {
|
import {
|
||||||
ConfigurationError,
|
ConfigurationError,
|
||||||
getRequiredEnvParam,
|
getRequiredEnvParam,
|
||||||
|
GitHubVariant,
|
||||||
GitHubVersion,
|
GitHubVersion,
|
||||||
SarifFile,
|
SarifFile,
|
||||||
SarifRun,
|
SarifRun,
|
||||||
|
|
@ -123,11 +125,20 @@ function areAllRunsUnique(sarifObjects: SarifFile[]): boolean {
|
||||||
async function showCombineSarifFilesDeprecationWarning(
|
async function showCombineSarifFilesDeprecationWarning(
|
||||||
sarifObjects: util.SarifFile[],
|
sarifObjects: util.SarifFile[],
|
||||||
features: Features,
|
features: Features,
|
||||||
|
githubVersion: GitHubVersion,
|
||||||
) {
|
) {
|
||||||
if (!(await features.getValue(Feature.CombineSarifFilesDeprecationWarning))) {
|
if (!(await features.getValue(Feature.CombineSarifFilesDeprecationWarning))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not show this warning on GHES versions before 3.14.0
|
||||||
|
if (
|
||||||
|
githubVersion.type === GitHubVariant.GHES &&
|
||||||
|
semver.lt(githubVersion.version, "3.14.0")
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Only give a deprecation warning when not all runs are unique
|
// Only give a deprecation warning when not all runs are unique
|
||||||
return (
|
return (
|
||||||
!areAllRunsUnique(sarifObjects) &&
|
!areAllRunsUnique(sarifObjects) &&
|
||||||
|
|
@ -159,7 +170,13 @@ async function combineSarifFilesUsingCLI(
|
||||||
"Not all SARIF files were produced by CodeQL. Merging files in the action.",
|
"Not all SARIF files were produced by CodeQL. Merging files in the action.",
|
||||||
);
|
);
|
||||||
|
|
||||||
if (await showCombineSarifFilesDeprecationWarning(sarifObjects, features)) {
|
if (
|
||||||
|
await showCombineSarifFilesDeprecationWarning(
|
||||||
|
sarifObjects,
|
||||||
|
features,
|
||||||
|
gitHubVersion,
|
||||||
|
)
|
||||||
|
) {
|
||||||
logger.warning(
|
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",
|
"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",
|
||||||
);
|
);
|
||||||
|
|
@ -216,7 +233,13 @@ async function combineSarifFilesUsingCLI(
|
||||||
"The CodeQL CLI does not support merging SARIF files. Merging files in the action.",
|
"The CodeQL CLI does not support merging SARIF files. Merging files in the action.",
|
||||||
);
|
);
|
||||||
|
|
||||||
if (await showCombineSarifFilesDeprecationWarning(sarifObjects, features)) {
|
if (
|
||||||
|
await showCombineSarifFilesDeprecationWarning(
|
||||||
|
sarifObjects,
|
||||||
|
features,
|
||||||
|
gitHubVersion,
|
||||||
|
)
|
||||||
|
) {
|
||||||
logger.warning(
|
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",
|
"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",
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue