Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Address comments
  • Loading branch information
David Verdeguer committed May 5, 2021
1 parent aa53f64 commit cd7eedd
Showing 8 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/actions-util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/actions-util.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lib/actions-util.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/actions-util.test.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/upload-lib.js.map

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/actions-util.test.ts
@@ -112,6 +112,16 @@ test("computeAutomationID()", async (t) => {
actualAutomationID,
".github/workflows/codeql-analysis.yml:analyze/number:/object:/"
);

// check undefined environment
actualAutomationID = actionsutil.computeAutomationID(
".github/workflows/codeql-analysis.yml:analyze",
undefined
);
t.deepEqual(
actualAutomationID,
".github/workflows/codeql-analysis.yml:analyze/"
);
});

test("prepareEnvironment() when a local run", (t) => {
4 changes: 2 additions & 2 deletions src/actions-util.ts
@@ -433,13 +433,13 @@ export async function getAutomationID(): Promise<string> {
}

export function computeAutomationID(
analysis_key: string | undefined,
analysis_key: string,
environment: string | undefined
): string {
let automationID = `${analysis_key}/`;

// the id has to be deterministic so we sort the fields
if (environment !== undefined && environment !== "null") {
if (environment) {
const environmentObject = JSON.parse(environment);
for (const entry of Object.entries(environmentObject).sort()) {
if (typeof entry[1] === "string") {
2 changes: 1 addition & 1 deletion src/upload-lib.ts
@@ -67,7 +67,7 @@ export function populateRunAutomationDetails(

function getAutomationID(
category: string | undefined,
analysis_key: string | undefined,
analysis_key: string,
environment: string | undefined
): string {
if (category !== undefined) {

0 comments on commit cd7eedd

Please sign in to comment.