Skip to content

Commit cd7eedd

Browse files
committed
Address comments
1 parent aa53f64 commit cd7eedd

8 files changed

Lines changed: 20 additions & 7 deletions

lib/actions-util.js

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/actions-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.

lib/actions-util.test.js

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

lib/actions-util.test.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/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.

src/actions-util.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ test("computeAutomationID()", async (t) => {
112112
actualAutomationID,
113113
".github/workflows/codeql-analysis.yml:analyze/number:/object:/"
114114
);
115+
116+
// check undefined environment
117+
actualAutomationID = actionsutil.computeAutomationID(
118+
".github/workflows/codeql-analysis.yml:analyze",
119+
undefined
120+
);
121+
t.deepEqual(
122+
actualAutomationID,
123+
".github/workflows/codeql-analysis.yml:analyze/"
124+
);
115125
});
116126

117127
test("prepareEnvironment() when a local run", (t) => {

src/actions-util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,13 @@ export async function getAutomationID(): Promise<string> {
433433
}
434434

435435
export function computeAutomationID(
436-
analysis_key: string | undefined,
436+
analysis_key: string,
437437
environment: string | undefined
438438
): string {
439439
let automationID = `${analysis_key}/`;
440440

441441
// the id has to be deterministic so we sort the fields
442-
if (environment !== undefined && environment !== "null") {
442+
if (environment) {
443443
const environmentObject = JSON.parse(environment);
444444
for (const entry of Object.entries(environmentObject).sort()) {
445445
if (typeof entry[1] === "string") {

src/upload-lib.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function populateRunAutomationDetails(
6767

6868
function getAutomationID(
6969
category: string | undefined,
70-
analysis_key: string | undefined,
70+
analysis_key: string,
7171
environment: string | undefined
7272
): string {
7373
if (category !== undefined) {

0 commit comments

Comments
 (0)