Skip to content

Commit b42a495

Browse files
committed
Fix TRAP directory location
1 parent 5b4b44c commit b42a495

3 files changed

Lines changed: 37 additions & 16 deletions

File tree

lib/analyze-action.js

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

lib/analyze-action.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/analyze-action.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// We need to import `performance` on Node 12
21
import * as fs from "fs";
2+
import path from "path";
3+
// We need to import `performance` on Node 12
34
import { performance } from "perf_hooks";
45

56
import * as core from "@actions/core";
@@ -32,12 +33,12 @@ const pkg = require("../package.json");
3233

3334
interface AnalysisStatusReport
3435
extends upload_lib.UploadStatusReport,
35-
QueriesStatusReport { }
36+
QueriesStatusReport {}
3637

3738
interface FinishStatusReport
3839
extends actionsUtil.StatusReportBase,
39-
actionsUtil.DatabaseCreationTimings,
40-
AnalysisStatusReport { }
40+
actionsUtil.DatabaseCreationTimings,
41+
AnalysisStatusReport {}
4142

4243
interface FinishWithTrapUploadStatusReport extends FinishStatusReport {
4344
/** Size of TRAP caches that we uploaded, in bytes. */
@@ -71,9 +72,9 @@ export async function sendStatusReport(
7172
...statusReportBase,
7273
...(config
7374
? {
74-
ml_powered_javascript_queries:
75-
util.getMlPoweredJsQueriesStatus(config),
76-
}
75+
ml_powered_javascript_queries:
76+
util.getMlPoweredJsQueriesStatus(config),
77+
}
7778
: {}),
7879
...(stats || {}),
7980
...(dbCreationTimings || {}),
@@ -101,15 +102,23 @@ function hasBadExpectErrorInput(): boolean {
101102
}
102103

103104
/**
104-
* Returns whether any `.trap[.gz]` files exist under the `db-go` folder,
105+
* Returns whether any TRAP files exist under the `db-go` folder,
105106
* indicating whether Go extraction has extracted at least one file.
106107
*/
107108
function doesGoExtractionOutputExist(config: Config): boolean {
108109
const golangDbDirectory = util.getCodeQLDatabasePath(config, Language.go);
110+
const trapDirectory = path.join(golangDbDirectory, "trap", Language.go);
109111
return fs
110-
.readdirSync(golangDbDirectory)
111-
.some(
112-
(fileName) => fileName.endsWith(".trap") || fileName.endsWith(".trap.gz")
112+
.readdirSync(trapDirectory)
113+
.some((fileName) =>
114+
[
115+
".trap",
116+
".trap.gz",
117+
".trap.br",
118+
".trap.tar.gz",
119+
".trap.tar.br",
120+
".trap.tar",
121+
].some((ext) => fileName.endsWith(ext))
113122
);
114123
}
115124

0 commit comments

Comments
 (0)