Skip to content

Commit db6938a

Browse files
committed
Change check to be restrictive by default
1 parent c77b3fb commit db6938a

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

lib/init-action-post.js

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

src/init-action-post-helper.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,14 @@ test("uploading failed SARIF run fails when workflow does not reference github/c
297297
t.truthy(result.upload_failed_run_stack_trace);
298298
});
299299

300-
test("not uploading failed SARIF when `code-quality` is the only analysis kind", async (t) => {
300+
test("not uploading failed SARIF when `code-scanning` is not an enabled analysis kind", async (t) => {
301301
const result = await testFailedSarifUpload(t, createTestWorkflow([]), {
302302
analysisKinds: [AnalysisKind.CodeQuality],
303303
expectUpload: false,
304304
});
305305
t.is(
306306
result.upload_failed_run_skipped_because,
307-
"Code Quality is the only enabled analysis kind.",
307+
"Code Scanning is not enabled.",
308308
);
309309
});
310310

src/init-action-post-helper.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as actionsUtil from "./actions-util";
77
import { CodeScanning } from "./analyses";
88
import { getApiClient } from "./api-client";
99
import { CodeQL, getCodeQL } from "./codeql";
10-
import { Config, isCodeQualityEnabled } from "./config-utils";
10+
import { Config, isCodeScanningEnabled } from "./config-utils";
1111
import * as dependencyCaching from "./dependency-caching";
1212
import { EnvVar } from "./environment";
1313
import { Feature, FeatureEnablement } from "./feature-flags";
@@ -142,10 +142,9 @@ export async function tryUploadSarifIfRunFailed(
142142

143143
// If the only enabled analysis kind is `code-quality`, then we shouldn't
144144
// upload the failed SARIF to Code Scanning.
145-
if (config.analysisKinds.length === 1 && isCodeQualityEnabled(config)) {
145+
if (!isCodeScanningEnabled(config)) {
146146
return {
147-
upload_failed_run_skipped_because:
148-
"Code Quality is the only enabled analysis kind.",
147+
upload_failed_run_skipped_because: "Code Scanning is not enabled.",
149148
};
150149
}
151150

0 commit comments

Comments
 (0)