mirror of
https://github.com/github/codeql-action.git
synced 2026-01-01 04:00:24 +08:00
Rename uploadSarif
This commit is contained in:
@@ -52,7 +52,7 @@ import {
|
||||
} from "./trap-caching";
|
||||
import * as uploadLib from "./upload-lib";
|
||||
import { UploadResult } from "./upload-lib";
|
||||
import { uploadSarif } from "./upload-sarif";
|
||||
import { processAndUploadSarif } from "./upload-sarif";
|
||||
import * as util from "./util";
|
||||
|
||||
interface AnalysisStatusReport
|
||||
@@ -352,7 +352,7 @@ async function run() {
|
||||
const category = actionsUtil.getOptionalInput("category");
|
||||
|
||||
if (await features.getValue(Feature.AnalyzeUseNewUpload)) {
|
||||
uploadResults = await uploadSarif(
|
||||
uploadResults = await processAndUploadSarif(
|
||||
logger,
|
||||
features,
|
||||
uploadKind,
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
isThirdPartyAnalysis,
|
||||
} from "./status-report";
|
||||
import * as upload_lib from "./upload-lib";
|
||||
import { uploadSarif } from "./upload-sarif";
|
||||
import { processAndUploadSarif } from "./upload-sarif";
|
||||
import {
|
||||
ConfigurationError,
|
||||
checkActionVersion,
|
||||
@@ -90,7 +90,7 @@ async function run() {
|
||||
const checkoutPath = actionsUtil.getRequiredInput("checkout_path");
|
||||
const category = actionsUtil.getOptionalInput("category");
|
||||
|
||||
const uploadResults = await uploadSarif(
|
||||
const uploadResults = await processAndUploadSarif(
|
||||
logger,
|
||||
features,
|
||||
"always",
|
||||
|
||||
@@ -9,7 +9,7 @@ import { getRunnerLogger } from "./logging";
|
||||
import { createFeatures, setupTests } from "./testing-utils";
|
||||
import { UploadResult } from "./upload-lib";
|
||||
import * as uploadLib from "./upload-lib";
|
||||
import { uploadSarif } from "./upload-sarif";
|
||||
import { processAndUploadSarif } from "./upload-sarif";
|
||||
import * as util from "./util";
|
||||
|
||||
setupTests(test);
|
||||
@@ -39,7 +39,7 @@ function mockPostProcessSarifFiles() {
|
||||
return postProcessSarifFiles;
|
||||
}
|
||||
|
||||
const uploadSarifMacro = test.macro({
|
||||
const processAndUploadSarifMacro = test.macro({
|
||||
exec: async (
|
||||
t: ExecutionContext<unknown>,
|
||||
sarifFiles: string[],
|
||||
@@ -71,7 +71,7 @@ const uploadSarifMacro = test.macro({
|
||||
fs.writeFileSync(sarifFile, "");
|
||||
}
|
||||
|
||||
const actual = await uploadSarif(
|
||||
const actual = await processAndUploadSarif(
|
||||
logger,
|
||||
features,
|
||||
"always",
|
||||
@@ -116,12 +116,12 @@ const uploadSarifMacro = test.macro({
|
||||
}
|
||||
});
|
||||
},
|
||||
title: (providedTitle = "") => `uploadSarif - ${providedTitle}`,
|
||||
title: (providedTitle = "") => `processAndUploadSarif - ${providedTitle}`,
|
||||
});
|
||||
|
||||
test(
|
||||
"SARIF file",
|
||||
uploadSarifMacro,
|
||||
processAndUploadSarifMacro,
|
||||
["test.sarif"],
|
||||
(tempDir) => path.join(tempDir, "test.sarif"),
|
||||
{
|
||||
@@ -136,7 +136,7 @@ test(
|
||||
|
||||
test(
|
||||
"JSON file",
|
||||
uploadSarifMacro,
|
||||
processAndUploadSarifMacro,
|
||||
["test.json"],
|
||||
(tempDir) => path.join(tempDir, "test.json"),
|
||||
{
|
||||
@@ -151,7 +151,7 @@ test(
|
||||
|
||||
test(
|
||||
"Code Scanning files",
|
||||
uploadSarifMacro,
|
||||
processAndUploadSarifMacro,
|
||||
["test.json", "test.sarif"],
|
||||
undefined,
|
||||
{
|
||||
@@ -167,7 +167,7 @@ test(
|
||||
|
||||
test(
|
||||
"Code Quality file",
|
||||
uploadSarifMacro,
|
||||
processAndUploadSarifMacro,
|
||||
["test.quality.sarif"],
|
||||
(tempDir) => path.join(tempDir, "test.quality.sarif"),
|
||||
{
|
||||
@@ -182,7 +182,7 @@ test(
|
||||
|
||||
test(
|
||||
"Mixed files",
|
||||
uploadSarifMacro,
|
||||
processAndUploadSarifMacro,
|
||||
["test.sarif", "test.quality.sarif"],
|
||||
undefined,
|
||||
{
|
||||
@@ -203,7 +203,7 @@ test(
|
||||
},
|
||||
);
|
||||
|
||||
test("uploadSarif doesn't upload if upload is disabled", async (t) => {
|
||||
test("processAndUploadSarif doesn't upload if upload is disabled", async (t) => {
|
||||
await util.withTmpDir(async (tempDir) => {
|
||||
const logger = getRunnerLogger(true);
|
||||
const features = createFeatures([]);
|
||||
@@ -216,7 +216,7 @@ test("uploadSarif doesn't upload if upload is disabled", async (t) => {
|
||||
fs.writeFileSync(toFullPath("test.sarif"), "");
|
||||
fs.writeFileSync(toFullPath("test.quality.sarif"), "");
|
||||
|
||||
const actual = await uploadSarif(logger, features, "never", "", tempDir);
|
||||
const actual = await processAndUploadSarif(logger, features, "never", "", tempDir);
|
||||
|
||||
t.truthy(actual);
|
||||
t.assert(postProcessSarifFiles.calledTwice);
|
||||
@@ -224,7 +224,7 @@ test("uploadSarif doesn't upload if upload is disabled", async (t) => {
|
||||
});
|
||||
});
|
||||
|
||||
test("uploadSarif writes processed SARIF files if output directory is provided", async (t) => {
|
||||
test("processAndUploadSarif writes processed SARIF files if output directory is provided", async (t) => {
|
||||
await util.withTmpDir(async (tempDir) => {
|
||||
const logger = getRunnerLogger(true);
|
||||
const features = createFeatures([]);
|
||||
@@ -237,7 +237,7 @@ test("uploadSarif writes processed SARIF files if output directory is provided",
|
||||
fs.writeFileSync(toFullPath("test.quality.sarif"), "");
|
||||
|
||||
const processedOutPath = path.join(tempDir, "processed");
|
||||
const actual = await uploadSarif(
|
||||
const actual = await processAndUploadSarif(
|
||||
logger,
|
||||
features,
|
||||
"never",
|
||||
|
||||
@@ -23,7 +23,7 @@ export type UploadSarifResults = Partial<
|
||||
*
|
||||
* @returns A partial mapping from analysis kinds to the upload results.
|
||||
*/
|
||||
export async function uploadSarif(
|
||||
export async function processAndUploadSarif(
|
||||
logger: Logger,
|
||||
features: FeatureEnablement,
|
||||
uploadKind: UploadKind,
|
||||
|
||||
Reference in New Issue
Block a user