Categorize Code Quality "not enabled" upload failure as user-error

When a repository requests Code Quality analysis but it is not enabled,
the SARIF upload to `PUT /repos/:owner/:repo/code-quality/analysis`
returns a 403 with the message "Code quality is not enabled for this
repository...". `isEnablementError` did not recognize this wording, so
`wrapApiConfigurationError` left it as a plain Error and the analyze job
was reported with `status=failure` instead of `user-error`.

Add a `/Code Quality is not enabled/i` pattern so the error becomes a
ConfigurationError and `getActionsStatus` categorizes it as `user-error`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Henry Mercer
2026-06-23 16:23:41 +01:00
parent 09dec6cc8c
commit 6feed5452f
3 changed files with 4 additions and 1 deletions

3
lib/entry-points.js generated
View File

@@ -149561,7 +149561,8 @@ function isEnablementError(msg) {
return [
/Code Security must be enabled/i,
/Advanced Security must be enabled/i,
/Code Scanning is not enabled/i
/Code Scanning is not enabled/i,
/Code Quality is not enabled/i
].some((pattern) => pattern.test(msg));
}
function getFeatureEnablementError(message) {

View File

@@ -181,6 +181,7 @@ test.serial(
"Code Security must be enabled for this repository to use code scanning",
"Advanced Security must be enabled for this repository to use code scanning",
"Code Scanning is not enabled for this repository. Please enable code scanning in the repository settings.",
"Code quality is not enabled for this repository. Please enable code quality in the repository settings.",
];
const transforms = [
(msg: string) => msg,

View File

@@ -311,6 +311,7 @@ function isEnablementError(msg: string) {
/Code Security must be enabled/i,
/Advanced Security must be enabled/i,
/Code Scanning is not enabled/i,
/Code Quality is not enabled/i,
].some((pattern) => pattern.test(msg));
}