Skip to content

Commit

Permalink
Fixed issue #36
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhoski committed Jul 9, 2024
1 parent 2fe0f04 commit 8b40c16
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024 The MathWorks, Inc.
import * as core from "@actions/core";
import { join } from 'path';
import { readFileSync } from 'fs';
import { readFileSync, unlinkSync} from 'fs';

export interface Task {
name: string;
Expand Down Expand Up @@ -41,14 +41,20 @@ export function processAndDisplayBuildSummary() {
const runId = process.env.GITHUB_RUN_ID || '';
const runnerTemp = process.env.RUNNER_TEMP || '';

const filePath: string = join(runnerTemp, `buildSummary${runId}.json`);
let taskSummaryTableRows;
try {
const filePath: string = join(runnerTemp, `buildSummary${runId}.json`);
const data = JSON.parse(readFileSync(filePath, { encoding: 'utf8' }));
taskSummaryTableRows = getBuildSummaryTable(data);
} catch (e) {
console.error('An error occurred while reading the build summary file:', e);
return;
} finally {
try {
unlinkSync(filePath);
} catch (e) {
console.error(`An error occurred while trying to delete the file ${filePath}:`, e);
}
}
writeSummary(taskSummaryTableRows);
}
Expand Down

0 comments on commit 8b40c16

Please sign in to comment.