Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 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

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

2 changes: 1 addition & 1 deletion lib/combine-results.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/combine-results.js.map

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

12 changes: 8 additions & 4 deletions lib/query.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/query.js.map

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

3 changes: 2 additions & 1 deletion src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export { downloadDatabase, runQuery };
// Will operate on the current working directory and create the following
// directories:
// * query/ (query.ql and any other supporting files)
// * results/ (results.{bqrs,csv,json,md})
// * results/ (results.{bqrs,csv,json,md} and nwo.txt)
async function runQuery(
codeql: string,
language: string,
Expand All @@ -22,6 +22,7 @@ async function runQuery(
const bqrs = path.join("results", "results.bqrs");
const json = path.join("results", "results.json");
fs.mkdirSync("results");
fs.writeFileSync(path.join("results", "nwo.txt"), nwo);

const queryDir = "query";
fs.mkdirSync("query");
Expand Down
5 changes: 4 additions & 1 deletion src/combine-results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ async function run(): Promise<void> {
await mv(csv, csvDest);
csvs.push(csvDest);

const repoName = response.artifactName.replace("#", "/");
const repoName = fs.readFileSync(
path.join(response.downloadPath, "nwo.txt"),
"utf-8"
);
const output = await getExecOutput("wc", ["-l", csvDest]); // TODO: preferably we would do this during results interpretation
const results = parseInt(output.stdout.trim()) - 2;

Expand Down
12 changes: 8 additions & 4 deletions src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ async function run(): Promise<void> {
// 1. Use the GitHub API to download the database using token
const curDir = cwd();
for (const repo of repos) {
const safeNwo = repo.nwo.replace("/", "#");
const workDir = mkdtempSync(path.join(curDir, safeNwo));
const workDir = mkdtempSync(path.join(curDir, repo.id.toString()));
chdir(workDir);

// 1. Use the GitHub API to download the database using token
Expand All @@ -53,8 +52,13 @@ async function run(): Promise<void> {
// 3. Upload the results as an artifact
const artifactClient = createArtifactClient();
await artifactClient.uploadArtifact(
safeNwo, // name
["results/results.bqrs", "results/results.csv", "results/results.md"], // files
repo.id.toString(), // name
[
"results/results.bqrs",
"results/results.csv",
"results/results.md",
"results/nwo.txt",
], // files
"results", // rootdirectory
{ continueOnError: false, retentionDays: 1 }
);
Expand Down