mirror of
https://github.com/github/codeql-action.git
synced 2025-12-06 07:48:17 +08:00
Make isEnablementError case-insensitive
This commit is contained in:
6
lib/analyze-action.js
generated
6
lib/analyze-action.js
generated
@@ -83615,9 +83615,9 @@ async function deleteActionsCache(id) {
|
||||
}
|
||||
function isEnablementError(msg) {
|
||||
return [
|
||||
/Code Security must be enabled/,
|
||||
/Advanced Security must be enabled/,
|
||||
/Code Scanning is not enabled/
|
||||
/Code Security must be enabled/i,
|
||||
/Advanced Security must be enabled/i,
|
||||
/Code Scanning is not enabled/i
|
||||
].some((pattern) => pattern.test(msg));
|
||||
}
|
||||
function getFeatureEnablementError(message) {
|
||||
|
||||
6
lib/init-action-post.js
generated
6
lib/init-action-post.js
generated
@@ -116758,9 +116758,9 @@ async function listActionsCaches(key, ref) {
|
||||
}
|
||||
function isEnablementError(msg) {
|
||||
return [
|
||||
/Code Security must be enabled/,
|
||||
/Advanced Security must be enabled/,
|
||||
/Code Scanning is not enabled/
|
||||
/Code Security must be enabled/i,
|
||||
/Advanced Security must be enabled/i,
|
||||
/Code Scanning is not enabled/i
|
||||
].some((pattern) => pattern.test(msg));
|
||||
}
|
||||
function getFeatureEnablementError(message) {
|
||||
|
||||
6
lib/init-action.js
generated
6
lib/init-action.js
generated
@@ -80926,9 +80926,9 @@ async function getRepositoryProperties(repositoryNwo) {
|
||||
}
|
||||
function isEnablementError(msg) {
|
||||
return [
|
||||
/Code Security must be enabled/,
|
||||
/Advanced Security must be enabled/,
|
||||
/Code Scanning is not enabled/
|
||||
/Code Security must be enabled/i,
|
||||
/Advanced Security must be enabled/i,
|
||||
/Code Scanning is not enabled/i
|
||||
].some((pattern) => pattern.test(msg));
|
||||
}
|
||||
function getFeatureEnablementError(message) {
|
||||
|
||||
6
lib/setup-codeql-action.js
generated
6
lib/setup-codeql-action.js
generated
@@ -79275,9 +79275,9 @@ async function getAnalysisKey() {
|
||||
}
|
||||
function isEnablementError(msg) {
|
||||
return [
|
||||
/Code Security must be enabled/,
|
||||
/Advanced Security must be enabled/,
|
||||
/Code Scanning is not enabled/
|
||||
/Code Security must be enabled/i,
|
||||
/Advanced Security must be enabled/i,
|
||||
/Code Scanning is not enabled/i
|
||||
].some((pattern) => pattern.test(msg));
|
||||
}
|
||||
function getFeatureEnablementError(message) {
|
||||
|
||||
6
lib/upload-lib.js
generated
6
lib/upload-lib.js
generated
@@ -82146,9 +82146,9 @@ function computeAutomationID(analysis_key, environment) {
|
||||
}
|
||||
function isEnablementError(msg) {
|
||||
return [
|
||||
/Code Security must be enabled/,
|
||||
/Advanced Security must be enabled/,
|
||||
/Code Scanning is not enabled/
|
||||
/Code Security must be enabled/i,
|
||||
/Advanced Security must be enabled/i,
|
||||
/Code Scanning is not enabled/i
|
||||
].some((pattern) => pattern.test(msg));
|
||||
}
|
||||
function getFeatureEnablementError(message) {
|
||||
|
||||
6
lib/upload-sarif-action.js
generated
6
lib/upload-sarif-action.js
generated
@@ -82191,9 +82191,9 @@ function computeAutomationID(analysis_key, environment) {
|
||||
}
|
||||
function isEnablementError(msg) {
|
||||
return [
|
||||
/Code Security must be enabled/,
|
||||
/Advanced Security must be enabled/,
|
||||
/Code Scanning is not enabled/
|
||||
/Code Security must be enabled/i,
|
||||
/Advanced Security must be enabled/i,
|
||||
/Code Scanning is not enabled/i
|
||||
].some((pattern) => pattern.test(msg));
|
||||
}
|
||||
function getFeatureEnablementError(message) {
|
||||
|
||||
@@ -171,37 +171,30 @@ test("wrapApiConfigurationError correctly wraps specific configuration errors",
|
||||
);
|
||||
|
||||
// Enablement errors.
|
||||
const codeSecurityNotEnabledError = new util.HTTPError(
|
||||
const enablementErrorMessages = [
|
||||
"Code Security must be enabled for this repository to use code scanning",
|
||||
403,
|
||||
);
|
||||
res = api.wrapApiConfigurationError(codeSecurityNotEnabledError);
|
||||
t.deepEqual(
|
||||
res,
|
||||
new util.ConfigurationError(
|
||||
api.getFeatureEnablementError(codeSecurityNotEnabledError.message),
|
||||
),
|
||||
);
|
||||
const advancedSecurityNotEnabledError = new util.HTTPError(
|
||||
"Advanced Security must be enabled for this repository to use code scanning",
|
||||
403,
|
||||
);
|
||||
res = api.wrapApiConfigurationError(advancedSecurityNotEnabledError);
|
||||
t.deepEqual(
|
||||
res,
|
||||
new util.ConfigurationError(
|
||||
api.getFeatureEnablementError(advancedSecurityNotEnabledError.message),
|
||||
),
|
||||
);
|
||||
const codeScanningNotEnabledError = new util.HTTPError(
|
||||
"Code Scanning is not enabled for this repository. Please enable code scanning in the repository settings.",
|
||||
403,
|
||||
);
|
||||
res = api.wrapApiConfigurationError(codeScanningNotEnabledError);
|
||||
t.deepEqual(
|
||||
res,
|
||||
new util.ConfigurationError(
|
||||
api.getFeatureEnablementError(codeScanningNotEnabledError.message),
|
||||
),
|
||||
);
|
||||
];
|
||||
const transforms = [
|
||||
(msg: string) => msg,
|
||||
(msg: string) => msg.toLowerCase(),
|
||||
(msg: string) => msg.toLocaleUpperCase(),
|
||||
];
|
||||
|
||||
for (const enablementErrorMessage of enablementErrorMessages) {
|
||||
for (const transform of transforms) {
|
||||
const enablementError = new util.HTTPError(
|
||||
transform(enablementErrorMessage),
|
||||
403,
|
||||
);
|
||||
res = api.wrapApiConfigurationError(enablementError);
|
||||
t.deepEqual(
|
||||
res,
|
||||
new util.ConfigurationError(
|
||||
api.getFeatureEnablementError(enablementError.message),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -285,9 +285,9 @@ export async function getRepositoryProperties(repositoryNwo: RepositoryNwo) {
|
||||
|
||||
function isEnablementError(msg: string) {
|
||||
return [
|
||||
/Code Security must be enabled/,
|
||||
/Advanced Security must be enabled/,
|
||||
/Code Scanning is not enabled/,
|
||||
/Code Security must be enabled/i,
|
||||
/Advanced Security must be enabled/i,
|
||||
/Code Scanning is not enabled/i,
|
||||
].some((pattern) => pattern.test(msg));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user