Skip to content

Commit 6feed54

Browse files
henrymercerCopilot
andcommitted
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>
1 parent 09dec6c commit 6feed54

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

lib/entry-points.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api-client.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ test.serial(
181181
"Code Security must be enabled for this repository to use code scanning",
182182
"Advanced Security must be enabled for this repository to use code scanning",
183183
"Code Scanning is not enabled for this repository. Please enable code scanning in the repository settings.",
184+
"Code quality is not enabled for this repository. Please enable code quality in the repository settings.",
184185
];
185186
const transforms = [
186187
(msg: string) => msg,

src/api-client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ function isEnablementError(msg: string) {
311311
/Code Security must be enabled/i,
312312
/Advanced Security must be enabled/i,
313313
/Code Scanning is not enabled/i,
314+
/Code Quality is not enabled/i,
314315
].some((pattern) => pattern.test(msg));
315316
}
316317

0 commit comments

Comments
 (0)