Skip to content

Commit

Permalink
Updated as per review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhoski committed Jul 19, 2024
1 parent e1c9252 commit 4025520
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 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, unlinkSync, accessSync} from 'fs';
import { readFileSync, unlinkSync, existsSync} from 'fs';

export interface Task {
name: string;
Expand Down Expand Up @@ -43,7 +43,7 @@ export function processAndDisplayBuildSummary() {

const filePath: string = join(runnerTemp, `buildSummary${runId}.json`);
let taskSummaryTableRows;
if (checkFileExists(filePath)) {
if (existsSync(filePath)) {

try {
const data = JSON.parse(readFileSync(filePath, { encoding: 'utf8' }));
Expand Down Expand Up @@ -86,12 +86,3 @@ export function getTaskSummaryRows(task: Task, taskSummaryTableRows: string[][])
taskSummaryTableRows.push(taskDetails);
return taskSummaryTableRows;
}

function checkFileExists(filePath: string): boolean {
try {
accessSync(filePath);
return true;
} catch (err) {
return false;
}
}

0 comments on commit 4025520

Please sign in to comment.