|
1 | | -// We need to import `performance` on Node 12 |
2 | 1 | import * as fs from "fs"; |
| 2 | +import path from "path"; |
| 3 | +// We need to import `performance` on Node 12 |
3 | 4 | import { performance } from "perf_hooks"; |
4 | 5 |
|
5 | 6 | import * as core from "@actions/core"; |
@@ -32,12 +33,12 @@ const pkg = require("../package.json"); |
32 | 33 |
|
33 | 34 | interface AnalysisStatusReport |
34 | 35 | extends upload_lib.UploadStatusReport, |
35 | | - QueriesStatusReport { } |
| 36 | + QueriesStatusReport {} |
36 | 37 |
|
37 | 38 | interface FinishStatusReport |
38 | 39 | extends actionsUtil.StatusReportBase, |
39 | | - actionsUtil.DatabaseCreationTimings, |
40 | | - AnalysisStatusReport { } |
| 40 | + actionsUtil.DatabaseCreationTimings, |
| 41 | + AnalysisStatusReport {} |
41 | 42 |
|
42 | 43 | interface FinishWithTrapUploadStatusReport extends FinishStatusReport { |
43 | 44 | /** Size of TRAP caches that we uploaded, in bytes. */ |
@@ -71,9 +72,9 @@ export async function sendStatusReport( |
71 | 72 | ...statusReportBase, |
72 | 73 | ...(config |
73 | 74 | ? { |
74 | | - ml_powered_javascript_queries: |
75 | | - util.getMlPoweredJsQueriesStatus(config), |
76 | | - } |
| 75 | + ml_powered_javascript_queries: |
| 76 | + util.getMlPoweredJsQueriesStatus(config), |
| 77 | + } |
77 | 78 | : {}), |
78 | 79 | ...(stats || {}), |
79 | 80 | ...(dbCreationTimings || {}), |
@@ -101,15 +102,23 @@ function hasBadExpectErrorInput(): boolean { |
101 | 102 | } |
102 | 103 |
|
103 | 104 | /** |
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, |
105 | 106 | * indicating whether Go extraction has extracted at least one file. |
106 | 107 | */ |
107 | 108 | function doesGoExtractionOutputExist(config: Config): boolean { |
108 | 109 | const golangDbDirectory = util.getCodeQLDatabasePath(config, Language.go); |
| 110 | + const trapDirectory = path.join(golangDbDirectory, "trap", Language.go); |
109 | 111 | 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)) |
113 | 122 | ); |
114 | 123 | } |
115 | 124 |
|
|
0 commit comments