mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 17:41:28 +00:00
Merge branch 'main' into sam-robson/overlay-per-lang-min-bundle-version
This commit is contained in:
@@ -5,6 +5,7 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
|
||||
## [UNRELEASED]
|
||||
|
||||
- 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)
|
||||
|
||||
## 4.32.6 - 05 Mar 2026
|
||||
|
||||
|
||||
@@ -161,6 +161,7 @@ export default [
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"args": "all",
|
||||
"argsIgnorePattern": "^_",
|
||||
}
|
||||
],
|
||||
|
||||
5
lib/analyze-action-post.js
generated
5
lib/analyze-action-post.js
generated
@@ -162212,11 +162212,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
|
||||
15
lib/analyze-action.js
generated
15
lib/analyze-action.js
generated
@@ -107961,11 +107961,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
@@ -112426,10 +112421,7 @@ function areAllRunsUnique(sarifLogs) {
|
||||
// src/upload-lib.ts
|
||||
var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning.";
|
||||
var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository.";
|
||||
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
|
||||
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
|
||||
return false;
|
||||
}
|
||||
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) {
|
||||
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
|
||||
}
|
||||
async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
|
||||
@@ -112462,10 +112454,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
logger.debug(
|
||||
"Not all SARIF files were produced by CodeQL. Merging files in the action."
|
||||
);
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(
|
||||
sarifObjects,
|
||||
gitHubVersion
|
||||
)) {
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) {
|
||||
logger.warning(
|
||||
`Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`
|
||||
);
|
||||
|
||||
5
lib/autobuild-action.js
generated
5
lib/autobuild-action.js
generated
@@ -104261,11 +104261,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
|
||||
15
lib/init-action-post.js
generated
15
lib/init-action-post.js
generated
@@ -165698,11 +165698,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
@@ -169516,10 +169511,7 @@ function areAllRunsUnique(sarifLogs) {
|
||||
// src/upload-lib.ts
|
||||
var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning.";
|
||||
var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository.";
|
||||
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
|
||||
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
|
||||
return false;
|
||||
}
|
||||
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) {
|
||||
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
|
||||
}
|
||||
async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
|
||||
@@ -169552,10 +169544,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
logger.debug(
|
||||
"Not all SARIF files were produced by CodeQL. Merging files in the action."
|
||||
);
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(
|
||||
sarifObjects,
|
||||
gitHubVersion
|
||||
)) {
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) {
|
||||
logger.warning(
|
||||
`Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`
|
||||
);
|
||||
|
||||
24
lib/init-action.js
generated
24
lib/init-action.js
generated
@@ -104424,10 +104424,7 @@ var repositoryPropertyParsers = {
|
||||
["github-codeql-disable-overlay" /* DISABLE_OVERLAY */]: booleanProperty,
|
||||
["github-codeql-extra-queries" /* EXTRA_QUERIES */]: stringProperty
|
||||
};
|
||||
async function loadPropertiesFromApi(gitHubVersion, logger, repositoryNwo) {
|
||||
if (gitHubVersion.type === "GitHub Enterprise Server" /* GHES */) {
|
||||
return {};
|
||||
}
|
||||
async function loadPropertiesFromApi(logger, repositoryNwo) {
|
||||
try {
|
||||
const response = await getRepositoryProperties(repositoryNwo);
|
||||
const remoteProperties = response.data;
|
||||
@@ -105521,11 +105518,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
@@ -109608,8 +109600,6 @@ async function run(startedAt) {
|
||||
);
|
||||
const repositoryPropertiesResult = await loadRepositoryProperties(
|
||||
repositoryNwo,
|
||||
gitHubVersion,
|
||||
features,
|
||||
logger
|
||||
);
|
||||
const jobRunUuid = v4_default();
|
||||
@@ -110009,7 +109999,7 @@ exec ${goBinaryPath} "$@"`
|
||||
logger
|
||||
);
|
||||
}
|
||||
async function loadRepositoryProperties(repositoryNwo, gitHubVersion, features, logger) {
|
||||
async function loadRepositoryProperties(repositoryNwo, logger) {
|
||||
const repositoryOwnerType = github2.context.payload.repository?.owner.type;
|
||||
logger.debug(
|
||||
`Repository owner type is '${repositoryOwnerType ?? "unknown"}'.`
|
||||
@@ -110020,16 +110010,8 @@ async function loadRepositoryProperties(repositoryNwo, gitHubVersion, features,
|
||||
);
|
||||
return new Success({});
|
||||
}
|
||||
if (!await features.getValue("use_repository_properties_v2" /* UseRepositoryProperties */)) {
|
||||
logger.debug(
|
||||
"Skipping loading repository properties because the UseRepositoryProperties feature flag is disabled."
|
||||
);
|
||||
return new Success({});
|
||||
}
|
||||
try {
|
||||
return new Success(
|
||||
await loadPropertiesFromApi(gitHubVersion, logger, repositoryNwo)
|
||||
);
|
||||
return new Success(await loadPropertiesFromApi(logger, repositoryNwo));
|
||||
} catch (error3) {
|
||||
logger.warning(
|
||||
`Failed to load repository properties: ${getErrorMessage(error3)}`
|
||||
|
||||
5
lib/resolve-environment-action.js
generated
5
lib/resolve-environment-action.js
generated
@@ -104252,11 +104252,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
|
||||
5
lib/setup-codeql-action.js
generated
5
lib/setup-codeql-action.js
generated
@@ -104149,11 +104149,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
|
||||
5
lib/start-proxy-action-post.js
generated
5
lib/start-proxy-action-post.js
generated
@@ -161618,11 +161618,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
|
||||
5
lib/start-proxy-action.js
generated
5
lib/start-proxy-action.js
generated
@@ -120941,11 +120941,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
|
||||
15
lib/upload-lib.js
generated
15
lib/upload-lib.js
generated
@@ -107408,11 +107408,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
@@ -110313,10 +110308,7 @@ function areAllRunsUnique(sarifLogs) {
|
||||
// src/upload-lib.ts
|
||||
var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning.";
|
||||
var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository.";
|
||||
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
|
||||
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
|
||||
return false;
|
||||
}
|
||||
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) {
|
||||
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
|
||||
}
|
||||
async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
|
||||
@@ -110349,10 +110341,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
logger.debug(
|
||||
"Not all SARIF files were produced by CodeQL. Merging files in the action."
|
||||
);
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(
|
||||
sarifObjects,
|
||||
gitHubVersion
|
||||
)) {
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) {
|
||||
logger.warning(
|
||||
`Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`
|
||||
);
|
||||
|
||||
5
lib/upload-sarif-action-post.js
generated
5
lib/upload-sarif-action-post.js
generated
@@ -161780,11 +161780,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
|
||||
15
lib/upload-sarif-action.js
generated
15
lib/upload-sarif-action.js
generated
@@ -107122,11 +107122,6 @@ var featureConfig = {
|
||||
minimumVersion: void 0,
|
||||
toolsFeature: "bundleSupportsOverlay" /* BundleSupportsOverlay */
|
||||
},
|
||||
["use_repository_properties_v2" /* UseRepositoryProperties */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["validate_db_config" /* ValidateDbConfig */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
@@ -110905,10 +110900,7 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
|
||||
// src/upload-lib.ts
|
||||
var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning.";
|
||||
var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository.";
|
||||
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
|
||||
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
|
||||
return false;
|
||||
}
|
||||
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) {
|
||||
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
|
||||
}
|
||||
async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
|
||||
@@ -110941,10 +110933,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
logger.debug(
|
||||
"Not all SARIF files were produced by CodeQL. Merging files in the action."
|
||||
);
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(
|
||||
sarifObjects,
|
||||
gitHubVersion
|
||||
)) {
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) {
|
||||
logger.warning(
|
||||
`Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`
|
||||
);
|
||||
|
||||
@@ -87,7 +87,6 @@ export enum Feature {
|
||||
StartProxyRemoveUnusedRegistries = "start_proxy_remove_unused_registries",
|
||||
StartProxyUseFeaturesRelease = "start_proxy_use_features_release",
|
||||
UploadOverlayDbToApi = "upload_overlay_db_to_api",
|
||||
UseRepositoryProperties = "use_repository_properties_v2",
|
||||
ValidateDbConfig = "validate_db_config",
|
||||
}
|
||||
|
||||
@@ -315,11 +314,6 @@ export const featureConfig = {
|
||||
minimumVersion: undefined,
|
||||
toolsFeature: ToolsFeature.BundleSupportsOverlay,
|
||||
},
|
||||
[Feature.UseRepositoryProperties]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_USE_REPOSITORY_PROPERTIES",
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.ValidateDbConfig]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_VALIDATE_DB_CONFIG",
|
||||
|
||||
@@ -5,7 +5,6 @@ import * as api from "../api-client";
|
||||
import { getRunnerLogger } from "../logging";
|
||||
import { parseRepositoryNwo } from "../repository";
|
||||
import { setupTests } from "../testing-utils";
|
||||
import * as util from "../util";
|
||||
|
||||
import * as properties from "./properties";
|
||||
|
||||
@@ -23,13 +22,7 @@ test.serial(
|
||||
const logger = getRunnerLogger(true);
|
||||
const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
||||
await t.throwsAsync(
|
||||
properties.loadPropertiesFromApi(
|
||||
{
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
logger,
|
||||
mockRepositoryNwo,
|
||||
),
|
||||
properties.loadPropertiesFromApi(logger, mockRepositoryNwo),
|
||||
{
|
||||
message: /Expected repository properties API to return an array/,
|
||||
},
|
||||
@@ -49,13 +42,7 @@ test.serial(
|
||||
const logger = getRunnerLogger(true);
|
||||
const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
||||
await t.throwsAsync(
|
||||
properties.loadPropertiesFromApi(
|
||||
{
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
logger,
|
||||
mockRepositoryNwo,
|
||||
),
|
||||
properties.loadPropertiesFromApi(logger, mockRepositoryNwo),
|
||||
{
|
||||
message:
|
||||
/Expected repository property object to have a 'property_name'/,
|
||||
@@ -79,43 +66,11 @@ test.serial(
|
||||
const logger = getRunnerLogger(true);
|
||||
const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
||||
await t.notThrowsAsync(
|
||||
properties.loadPropertiesFromApi(
|
||||
{
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
logger,
|
||||
mockRepositoryNwo,
|
||||
),
|
||||
properties.loadPropertiesFromApi(logger, mockRepositoryNwo),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test.serial(
|
||||
"loadPropertiesFromApi returns empty object if on GHES",
|
||||
async (t) => {
|
||||
sinon.stub(api, "getRepositoryProperties").resolves({
|
||||
headers: {},
|
||||
status: 200,
|
||||
url: "",
|
||||
data: [
|
||||
{ property_name: "github-codeql-extra-queries", value: "+queries" },
|
||||
{ property_name: "unknown-property", value: "something" },
|
||||
] satisfies properties.GitHubPropertiesResponse,
|
||||
});
|
||||
const logger = getRunnerLogger(true);
|
||||
const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
||||
const response = await properties.loadPropertiesFromApi(
|
||||
{
|
||||
type: util.GitHubVariant.GHES,
|
||||
version: "",
|
||||
},
|
||||
logger,
|
||||
mockRepositoryNwo,
|
||||
);
|
||||
t.deepEqual(response, {});
|
||||
},
|
||||
);
|
||||
|
||||
test.serial("loadPropertiesFromApi loads known properties", async (t) => {
|
||||
sinon.stub(api, "getRepositoryProperties").resolves({
|
||||
headers: {},
|
||||
@@ -129,9 +84,6 @@ test.serial("loadPropertiesFromApi loads known properties", async (t) => {
|
||||
const logger = getRunnerLogger(true);
|
||||
const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
||||
const response = await properties.loadPropertiesFromApi(
|
||||
{
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
logger,
|
||||
mockRepositoryNwo,
|
||||
);
|
||||
@@ -155,9 +107,6 @@ test.serial("loadPropertiesFromApi parses true boolean property", async (t) => {
|
||||
const warningSpy = sinon.spy(logger, "warning");
|
||||
const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
||||
const response = await properties.loadPropertiesFromApi(
|
||||
{
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
logger,
|
||||
mockRepositoryNwo,
|
||||
);
|
||||
@@ -186,9 +135,6 @@ test.serial(
|
||||
const warningSpy = sinon.spy(logger, "warning");
|
||||
const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
||||
const response = await properties.loadPropertiesFromApi(
|
||||
{
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
logger,
|
||||
mockRepositoryNwo,
|
||||
);
|
||||
@@ -211,13 +157,7 @@ test.serial(
|
||||
const logger = getRunnerLogger(true);
|
||||
const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
||||
await t.throwsAsync(
|
||||
properties.loadPropertiesFromApi(
|
||||
{
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
logger,
|
||||
mockRepositoryNwo,
|
||||
),
|
||||
properties.loadPropertiesFromApi(logger, mockRepositoryNwo),
|
||||
{
|
||||
message:
|
||||
/Unexpected value for repository property 'github-codeql-extra-queries' \(number\), got: 123/,
|
||||
@@ -244,9 +184,6 @@ test.serial(
|
||||
const warningSpy = sinon.spy(logger, "warning");
|
||||
const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
||||
const response = await properties.loadPropertiesFromApi(
|
||||
{
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
logger,
|
||||
mockRepositoryNwo,
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { getRepositoryProperties } from "../api-client";
|
||||
import { Logger } from "../logging";
|
||||
import { RepositoryNwo } from "../repository";
|
||||
import { GitHubVariant, GitHubVersion } from "../util";
|
||||
|
||||
/**
|
||||
* Enumerates repository property names that have some meaning to us.
|
||||
@@ -93,16 +92,9 @@ export type GitHubPropertiesResponse = GitHubRepositoryProperty[];
|
||||
* @returns Returns a partial mapping from `RepositoryPropertyName` to values.
|
||||
*/
|
||||
export async function loadPropertiesFromApi(
|
||||
gitHubVersion: GitHubVersion,
|
||||
logger: Logger,
|
||||
repositoryNwo: RepositoryNwo,
|
||||
): Promise<RepositoryProperties> {
|
||||
// TODO: To be safe for now; later we should replace this with a version check once we know
|
||||
// which version of GHES we expect this to be supported by.
|
||||
if (gitHubVersion.type === GitHubVariant.GHES) {
|
||||
return {};
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await getRepositoryProperties(repositoryNwo);
|
||||
const remoteProperties = response.data as GitHubPropertiesResponse;
|
||||
|
||||
@@ -93,7 +93,6 @@ import {
|
||||
checkActionVersion,
|
||||
getErrorMessage,
|
||||
BuildMode,
|
||||
GitHubVersion,
|
||||
Result,
|
||||
getOptionalEnvVar,
|
||||
Success,
|
||||
@@ -250,8 +249,6 @@ async function run(startedAt: Date) {
|
||||
// Fetch the values of known repository properties that affect us.
|
||||
const repositoryPropertiesResult = await loadRepositoryProperties(
|
||||
repositoryNwo,
|
||||
gitHubVersion,
|
||||
features,
|
||||
logger,
|
||||
);
|
||||
|
||||
@@ -820,8 +817,6 @@ async function run(startedAt: Date) {
|
||||
*/
|
||||
async function loadRepositoryProperties(
|
||||
repositoryNwo: RepositoryNwo,
|
||||
gitHubVersion: GitHubVersion,
|
||||
features: FeatureEnablement,
|
||||
logger: Logger,
|
||||
): Promise<Result<RepositoryProperties, unknown>> {
|
||||
// See if we can skip loading repository properties early. In particular,
|
||||
@@ -839,17 +834,8 @@ async function loadRepositoryProperties(
|
||||
return new Success({});
|
||||
}
|
||||
|
||||
if (!(await features.getValue(Feature.UseRepositoryProperties))) {
|
||||
logger.debug(
|
||||
"Skipping loading repository properties because the UseRepositoryProperties feature flag is disabled.",
|
||||
);
|
||||
return new Success({});
|
||||
}
|
||||
|
||||
try {
|
||||
return new Success(
|
||||
await loadPropertiesFromApi(gitHubVersion, logger, repositoryNwo),
|
||||
);
|
||||
return new Success(await loadPropertiesFromApi(logger, repositoryNwo));
|
||||
} catch (error) {
|
||||
logger.warning(
|
||||
`Failed to load repository properties: ${getErrorMessage(error)}`,
|
||||
|
||||
@@ -356,7 +356,6 @@ export async function createStatusReportBase(
|
||||
statusReport.matrix_vars = matrix;
|
||||
}
|
||||
if ("RUNNER_ARCH" in process.env) {
|
||||
// RUNNER_ARCH is available only in GHES 3.4 and later
|
||||
// Values other than X86, X64, ARM, or ARM64 are discarded server side
|
||||
statusReport.runner_arch = process.env["RUNNER_ARCH"];
|
||||
}
|
||||
|
||||
@@ -631,57 +631,10 @@ test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning when on dotcom",
|
||||
async (t) => {
|
||||
t.true(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.13",
|
||||
async (t) => {
|
||||
t.false(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.13.2",
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.14",
|
||||
async (t) => {
|
||||
t.true(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.14.0",
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.16 pre",
|
||||
async (t) => {
|
||||
t.true(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.16.0.pre1",
|
||||
},
|
||||
),
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([
|
||||
createMockSarif("abc", "def"),
|
||||
createMockSarif("abc", "def"),
|
||||
]),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -690,12 +643,9 @@ test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning with only 1 run",
|
||||
async (t) => {
|
||||
t.false(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([
|
||||
createMockSarif("abc", "def"),
|
||||
]),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -704,12 +654,10 @@ test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning with distinct categories",
|
||||
async (t) => {
|
||||
t.false(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("def", "def")],
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([
|
||||
createMockSarif("abc", "def"),
|
||||
createMockSarif("def", "def"),
|
||||
]),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -718,12 +666,10 @@ test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning with distinct tools",
|
||||
async (t) => {
|
||||
t.false(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "abc"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([
|
||||
createMockSarif("abc", "abc"),
|
||||
createMockSarif("abc", "def"),
|
||||
]),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -734,12 +680,10 @@ test.serial(
|
||||
process.env["CODEQL_MERGE_SARIF_DEPRECATION_WARNING"] = "true";
|
||||
|
||||
t.false(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([
|
||||
createMockSarif("abc", "def"),
|
||||
createMockSarif("abc", "def"),
|
||||
]),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -759,18 +703,6 @@ test.serial("throwIfCombineSarifFilesDisabled when on dotcom", async (t) => {
|
||||
);
|
||||
});
|
||||
|
||||
test.serial("throwIfCombineSarifFilesDisabled when on GHES 3.13", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.13.2",
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test.serial("throwIfCombineSarifFilesDisabled when on GHES 3.14", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
|
||||
@@ -47,16 +47,7 @@ const GENERIC_404_MSG =
|
||||
// Checks whether the deprecation warning for combining SARIF files should be shown.
|
||||
export async function shouldShowCombineSarifFilesDeprecationWarning(
|
||||
sarifObjects: Array<Partial<sarif.Log>>,
|
||||
githubVersion: GitHubVersion,
|
||||
) {
|
||||
// Do not show this warning on GHES versions before 3.14.0
|
||||
if (
|
||||
githubVersion.type === GitHubVariant.GHES &&
|
||||
satisfiesGHESVersion(githubVersion.version, "<3.14", true)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only give a deprecation warning when not all runs are unique and
|
||||
// we haven't already shown the warning.
|
||||
return (
|
||||
@@ -131,12 +122,7 @@ async function combineSarifFilesUsingCLI(
|
||||
"Not all SARIF files were produced by CodeQL. Merging files in the action.",
|
||||
);
|
||||
|
||||
if (
|
||||
await shouldShowCombineSarifFilesDeprecationWarning(
|
||||
sarifObjects,
|
||||
gitHubVersion,
|
||||
)
|
||||
) {
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) {
|
||||
logger.warning(
|
||||
`Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user