Skip to content

Commit 548f07e

Browse files
authored
Merge pull request #1139 from github/aeisenberg/concat-not-push
Use concat instead of push around `listFolders`
2 parents d750c6d + a844fef commit 548f07e

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

lib/analyze-action.js

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze-action.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze-action.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,19 @@ async function run() {
151151

152152
if (config.debugMode) {
153153
// Upload the logs as an Actions artifact for debugging
154-
const toUpload: string[] = [];
154+
let toUpload: string[] = [];
155155
for (const language of config.languages) {
156-
toUpload.push(
157-
...listFolder(
156+
toUpload = toUpload.concat(
157+
listFolder(
158158
path.resolve(util.getCodeQLDatabasePath(config, language), "log")
159159
)
160160
);
161161
}
162162
if (await codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
163163
// Multilanguage tracing: there are additional logs in the root of the cluster
164-
toUpload.push(...listFolder(path.resolve(config.dbLocation, "log")));
164+
toUpload = toUpload.concat(
165+
listFolder(path.resolve(config.dbLocation, "log"))
166+
);
165167
}
166168
await uploadDebugArtifacts(
167169
toUpload,
@@ -319,12 +321,12 @@ async function uploadDebugArtifacts(
319321

320322
function listFolder(dir: string): string[] {
321323
const entries = fs.readdirSync(dir, { withFileTypes: true });
322-
const files: string[] = [];
324+
let files: string[] = [];
323325
for (const entry of entries) {
324326
if (entry.isFile()) {
325327
files.push(path.resolve(dir, entry.name));
326328
} else if (entry.isDirectory()) {
327-
files.push(...listFolder(path.resolve(dir, entry.name)));
329+
files = files.concat(listFolder(path.resolve(dir, entry.name)));
328330
}
329331
}
330332
return files;

0 commit comments

Comments
 (0)