Turn enablement errors into configuration errors

This commit is contained in:
Michael B. Gale
2025-10-28 21:17:30 +00:00
parent ac9aeee226
commit 53acf0b8aa
8 changed files with 120 additions and 0 deletions
+12
View File
@@ -83621,6 +83621,13 @@ async function deleteActionsCache(id) {
cache_id: id
});
}
function isEnablementError(msg) {
return [
/Code Security must be enabled/,
/Advanced Security must be enabled/,
/Code Scanning is not enabled/
].some((pattern) => pattern.test(msg));
}
function wrapApiConfigurationError(e) {
const httpError = asHTTPError(e);
if (httpError !== void 0) {
@@ -83637,6 +83644,11 @@ function wrapApiConfigurationError(e) {
"Please check that your token is valid and has the required permissions: contents: read, security-events: write"
);
}
if (isEnablementError(httpError.message)) {
return new ConfigurationError(
`Please verify that the necessary features are enabled: ${httpError.message}`
);
}
if (httpError.status === 429) {
return new ConfigurationError("API rate limit exceeded");
}
+12
View File
@@ -116758,6 +116758,13 @@ async function listActionsCaches(key, ref) {
}
);
}
function isEnablementError(msg) {
return [
/Code Security must be enabled/,
/Advanced Security must be enabled/,
/Code Scanning is not enabled/
].some((pattern) => pattern.test(msg));
}
function wrapApiConfigurationError(e) {
const httpError = asHTTPError(e);
if (httpError !== void 0) {
@@ -116774,6 +116781,11 @@ function wrapApiConfigurationError(e) {
"Please check that your token is valid and has the required permissions: contents: read, security-events: write"
);
}
if (isEnablementError(httpError.message)) {
return new ConfigurationError(
`Please verify that the necessary features are enabled: ${httpError.message}`
);
}
if (httpError.status === 429) {
return new ConfigurationError("API rate limit exceeded");
}
+12
View File
@@ -80926,6 +80926,13 @@ async function getRepositoryProperties(repositoryNwo) {
repo: repositoryNwo.repo
});
}
function isEnablementError(msg) {
return [
/Code Security must be enabled/,
/Advanced Security must be enabled/,
/Code Scanning is not enabled/
].some((pattern) => pattern.test(msg));
}
function wrapApiConfigurationError(e) {
const httpError = asHTTPError(e);
if (httpError !== void 0) {
@@ -80942,6 +80949,11 @@ function wrapApiConfigurationError(e) {
"Please check that your token is valid and has the required permissions: contents: read, security-events: write"
);
}
if (isEnablementError(httpError.message)) {
return new ConfigurationError(
`Please verify that the necessary features are enabled: ${httpError.message}`
);
}
if (httpError.status === 429) {
return new ConfigurationError("API rate limit exceeded");
}
+12
View File
@@ -79275,6 +79275,13 @@ async function getAnalysisKey() {
core5.exportVariable(analysisKeyEnvVar, analysisKey);
return analysisKey;
}
function isEnablementError(msg) {
return [
/Code Security must be enabled/,
/Advanced Security must be enabled/,
/Code Scanning is not enabled/
].some((pattern) => pattern.test(msg));
}
function wrapApiConfigurationError(e) {
const httpError = asHTTPError(e);
if (httpError !== void 0) {
@@ -79291,6 +79298,11 @@ function wrapApiConfigurationError(e) {
"Please check that your token is valid and has the required permissions: contents: read, security-events: write"
);
}
if (isEnablementError(httpError.message)) {
return new ConfigurationError(
`Please verify that the necessary features are enabled: ${httpError.message}`
);
}
if (httpError.status === 429) {
return new ConfigurationError("API rate limit exceeded");
}
+12
View File
@@ -82146,6 +82146,13 @@ function computeAutomationID(analysis_key, environment) {
}
return automationID;
}
function isEnablementError(msg) {
return [
/Code Security must be enabled/,
/Advanced Security must be enabled/,
/Code Scanning is not enabled/
].some((pattern) => pattern.test(msg));
}
function wrapApiConfigurationError(e) {
const httpError = asHTTPError(e);
if (httpError !== void 0) {
@@ -82162,6 +82169,11 @@ function wrapApiConfigurationError(e) {
"Please check that your token is valid and has the required permissions: contents: read, security-events: write"
);
}
if (isEnablementError(httpError.message)) {
return new ConfigurationError(
`Please verify that the necessary features are enabled: ${httpError.message}`
);
}
if (httpError.status === 429) {
return new ConfigurationError("API rate limit exceeded");
}
+12
View File
@@ -82191,6 +82191,13 @@ function computeAutomationID(analysis_key, environment) {
}
return automationID;
}
function isEnablementError(msg) {
return [
/Code Security must be enabled/,
/Advanced Security must be enabled/,
/Code Scanning is not enabled/
].some((pattern) => pattern.test(msg));
}
function wrapApiConfigurationError(e) {
const httpError = asHTTPError(e);
if (httpError !== void 0) {
@@ -82207,6 +82214,11 @@ function wrapApiConfigurationError(e) {
"Please check that your token is valid and has the required permissions: contents: read, security-events: write"
);
}
if (isEnablementError(httpError.message)) {
return new ConfigurationError(
`Please verify that the necessary features are enabled: ${httpError.message}`
);
}
if (httpError.status === 429) {
return new ConfigurationError("API rate limit exceeded");
}