Fix deduplication of bundle download sources.
This commit is contained in:
parent
24872f608c
commit
d182a0e3aa
5 changed files with 14 additions and 5 deletions
8
lib/codeql.js
generated
8
lib/codeql.js
generated
|
|
@ -6,6 +6,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
|
|
@ -14,6 +17,7 @@ const globalutil = __importStar(require("util"));
|
|||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
const http = __importStar(require("@actions/http-client"));
|
||||
const toolcache = __importStar(require("@actions/tool-cache"));
|
||||
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
||||
const semver = __importStar(require("semver"));
|
||||
const uuid_1 = require("uuid");
|
||||
const actions_util_1 = require("./actions-util");
|
||||
|
|
@ -76,7 +80,9 @@ async function getCodeQLBundleDownloadURL(apiDetails, mode, logger) {
|
|||
];
|
||||
// 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));
|
||||
const uniqueDownloadSources = potentialDownloadSources.filter((source, index, self) => {
|
||||
return !self.slice(0, index).some((other) => fast_deep_equal_1.default(source, other));
|
||||
});
|
||||
const codeQLBundleName = getCodeQLBundleName();
|
||||
for (const downloadSource of uniqueDownloadSources) {
|
||||
const [apiURL, repository] = downloadSource;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
3
package-lock.json
generated
3
package-lock.json
generated
|
|
@ -2077,8 +2077,7 @@
|
|||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||
"dev": true
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
},
|
||||
"fast-diff": {
|
||||
"version": "1.2.0",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue