Skip to content

Commit cd4c730

Browse files
authored
Merge pull request #14 from dsp-testing/rneatherway/use-repo-id
Use repository id for filenames
2 parents 59c7ec9 + 78bdfd5 commit cd4c730

9 files changed

Lines changed: 28 additions & 15 deletions

File tree

lib/codeql.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.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.

lib/combine-results.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/combine-results.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.

lib/query.js

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

lib/query.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/codeql.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export { downloadDatabase, runQuery };
1111
// Will operate on the current working directory and create the following
1212
// directories:
1313
// * query/ (query.ql and any other supporting files)
14-
// * results/ (results.{bqrs,csv,json,md})
14+
// * results/ (results.{bqrs,csv,json,md} and nwo.txt)
1515
async function runQuery(
1616
codeql: string,
1717
language: string,
@@ -22,6 +22,7 @@ async function runQuery(
2222
const bqrs = path.join("results", "results.bqrs");
2323
const json = path.join("results", "results.json");
2424
fs.mkdirSync("results");
25+
fs.writeFileSync(path.join("results", "nwo.txt"), nwo);
2526

2627
const queryDir = "query";
2728
fs.mkdirSync("query");

src/combine-results.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ async function run(): Promise<void> {
5252
await mv(csv, csvDest);
5353
csvs.push(csvDest);
5454

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

src/query.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ async function run(): Promise<void> {
3535
// 1. Use the GitHub API to download the database using token
3636
const curDir = cwd();
3737
for (const repo of repos) {
38-
const safeNwo = repo.nwo.replace("/", "#");
39-
const workDir = mkdtempSync(path.join(curDir, safeNwo));
38+
const workDir = mkdtempSync(path.join(curDir, repo.id.toString()));
4039
chdir(workDir);
4140

4241
// 1. Use the GitHub API to download the database using token
@@ -53,8 +52,13 @@ async function run(): Promise<void> {
5352
// 3. Upload the results as an artifact
5453
const artifactClient = createArtifactClient();
5554
await artifactClient.uploadArtifact(
56-
safeNwo, // name
57-
["results/results.bqrs", "results/results.csv", "results/results.md"], // files
55+
repo.id.toString(), // name
56+
[
57+
"results/results.bqrs",
58+
"results/results.csv",
59+
"results/results.md",
60+
"results/nwo.txt",
61+
], // files
5862
"results", // rootdirectory
5963
{ continueOnError: false, retentionDays: 1 }
6064
);

0 commit comments

Comments
 (0)