Skip to content

Commit 8ecbaea

Browse files
committed
Remove support for empty analysis keys from runner
1 parent 3d46406 commit 8ecbaea

File tree

6 files changed

+10
-59
lines changed

6 files changed

+10
-59
lines changed

lib/upload-lib.js

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

lib/upload-lib.js.map

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

lib/util.js

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

lib/util.js.map

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

src/upload-lib.ts

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function combineSarifFiles(sarifFiles: string[]): SarifFile {
5050
export function populateRunAutomationDetails(
5151
sarif: SarifFile,
5252
category: string | undefined,
53-
analysis_key: string | undefined,
53+
analysis_key: string,
5454
environment: string | undefined
5555
): SarifFile {
5656
const automationID = getAutomationID(category, analysis_key, environment);
@@ -70,7 +70,7 @@ export function populateRunAutomationDetails(
7070

7171
function getAutomationID(
7272
category: string | undefined,
73-
analysis_key: string | undefined,
73+
analysis_key: string,
7474
environment: string | undefined
7575
): string | undefined {
7676
if (category !== undefined) {
@@ -81,12 +81,7 @@ function getAutomationID(
8181
return automationID;
8282
}
8383

84-
// analysis_key is undefined for the runner.
85-
if (analysis_key !== undefined) {
86-
return actionsUtil.computeAutomationID(analysis_key, environment);
87-
}
88-
89-
return undefined;
84+
return actionsUtil.computeAutomationID(analysis_key, environment);
9085
}
9186

9287
// Upload the given payload.
@@ -190,37 +185,6 @@ export async function uploadFromActions(
190185
);
191186
}
192187

193-
// Uploads a single sarif file or a directory of sarif files
194-
// depending on what the path happens to refer to.
195-
// Returns true iff the upload occurred and succeeded
196-
export async function uploadFromRunner(
197-
sarifPath: string,
198-
repositoryNwo: RepositoryNwo,
199-
commitOid: string,
200-
ref: string,
201-
category: string | undefined,
202-
sourceRoot: string,
203-
gitHubVersion: util.GitHubVersion,
204-
apiDetails: api.GitHubApiDetails,
205-
logger: Logger
206-
): Promise<UploadResult> {
207-
return await uploadFiles(
208-
getSarifFilePaths(sarifPath),
209-
repositoryNwo,
210-
commitOid,
211-
ref,
212-
undefined,
213-
category,
214-
undefined,
215-
undefined,
216-
sourceRoot,
217-
undefined,
218-
gitHubVersion,
219-
apiDetails,
220-
logger
221-
);
222-
}
223-
224188
function getSarifFilePaths(sarifPath: string) {
225189
if (!fs.existsSync(sarifPath)) {
226190
throw new Error(`Path does not exist: ${sarifPath}`);
@@ -359,7 +323,7 @@ async function uploadFiles(
359323
repositoryNwo: RepositoryNwo,
360324
commitOid: string,
361325
ref: string,
362-
analysisKey: string | undefined,
326+
analysisKey: string,
363327
category: string | undefined,
364328
analysisName: string | undefined,
365329
workflowRunID: number | undefined,

src/util.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,7 @@ export function assertNever(value: never): never {
415415

416416
/**
417417
* Environment variables to be set by codeql-action and used by the
418-
* CLI. These environment variables are relevant for both the runner
419-
* and the action.
418+
* CLI.
420419
*/
421420
export enum EnvVar {
422421
/**

0 commit comments

Comments
 (0)