Skip to content

Commit

Permalink
Refactored the JSON strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhoski committed May 22, 2024
1 parent 8e69c86 commit 5e4c726
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
20 changes: 20 additions & 0 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,23 @@ export function addBuildSummaryTable(tasks: TaskList): void {
.addTable(taskSummaryTableRows)
.write();
}

async function processAndDisplayBuildSummary() {
const runId = process.env.GITHUB_RUN_ID;

if (!runId) {
console.error('GITHUB_RUN_ID environment variable is not set. Unable to locate the build summary file.');
return;
}

try {
const runnerTemp = process.env.RUNNER_TEMP;
console.log("________ "+ runnerTemp);
const filePath = `/tmp/buildSummary_${runId}.json`;
const data = await readJsonFile(filePath);
addBuildSummaryTable(data);
} catch (error) {
console.error('An error occurred while reading the build summary file or adding the build summary table:', error);
}
}

5 changes: 1 addition & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ async function run() {
(cmd,args)=>exec.exec(cmd,args,execOptions),
startupOptions
);
const runId = process.env.GITHUB_RUN_ID;
const data = await buildSummary.readJsonFile("/tmp/buildSummary_" + runId + ".json");
buildSummary.addBuildSummaryTable(data);

buildSummary.processAndDisplayBuildSummary();

Check failure on line 38 in src/index.ts

View workflow job for this annotation

GitHub Actions / Build and Test

Property 'processAndDisplayBuildSummary' does not exist on type 'typeof import("/home/runner/work/run-build/run-build/src/buildSummary")'.
}

run().catch((e) => {
Expand Down

0 comments on commit 5e4c726

Please sign in to comment.