Skip to content

Commit

Permalink
Fix deduplication of bundle download sources.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Gavin committed Jan 26, 2021
1 parent 24872f6 commit d182a0e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
8 changes: 7 additions & 1 deletion lib/codeql.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/codeql.js.map

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@octokit/types": "^5.5.0",
"commander": "^6.0.0",
"console-log-level": "^1.4.1",
"fast-deep-equal": "^3.1.3",
"file-url": "^3.0.0",
"fs": "0.0.1-security",
"js-yaml": "^3.13.1",
Expand Down
5 changes: 4 additions & 1 deletion src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as http from "@actions/http-client";
import { IHeaders } from "@actions/http-client/interfaces";
import * as toolcache from "@actions/tool-cache";
import { default as deepEqual } from "fast-deep-equal";
import * as semver from "semver";
import { v4 as uuidV4 } from "uuid";

Expand Down Expand Up @@ -176,7 +177,9 @@ async function getCodeQLBundleDownloadURL(
// We now filter out any duplicates.
// Duplicates will happen either because the GitHub instance is GitHub.com, or because the Action is not a fork.
const uniqueDownloadSources = potentialDownloadSources.filter(
(url, index, self) => index === self.indexOf(url)
(source, index, self) => {
return !self.slice(0, index).some((other) => deepEqual(source, other));
}
);
const codeQLBundleName = getCodeQLBundleName();
for (const downloadSource of uniqueDownloadSources) {
Expand Down

0 comments on commit d182a0e

Please sign in to comment.