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 Jun 26, 2024
1 parent b88efb6 commit b83d97c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugins/+ciplugins/+github/BuildSummaryPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function runTaskGraph(plugin, pluginData)
taskDetails(idx).duration = string(pluginData.TaskResults(idx).Duration);
end
a = struct("taskDetails",taskDetails);
s = jsonencode(a,PrettyPrint=true);
s = jsonencode(a);
fprintf(fID, "%s",s);
end
end
Expand Down
9 changes: 5 additions & 4 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function readJsonFile(filePath: string): Promise<TaskList> {
const data = await readFileAsync(filePath, { encoding: 'utf8' });
return JSON.parse(data);
} catch (error) {
console.error('Error reading the JSON file:', error);
console.error('Error reading the buildSummary file:', error);
throw error;
}
}
Expand Down Expand Up @@ -60,15 +60,16 @@ export function writeSummary(taskSummaryTableRows: string[][]) {

export async function processAndDisplayBuildSummary() {
const runId = process.env.GITHUB_RUN_ID;
let filePath: string;

if (!runId) {
console.error('GITHUB_RUN_ID environment variable is not set. Unable to locate the build summary file.');
return;
filePath = join(runnerTemp as string, `buildSummary_.json`);
} else {
filePath = join(runnerTemp as string, `buildSummary_${runId as string}.json`);
}

try {
const runnerTemp = process.env.RUNNER_TEMP;
const filePath = join(runnerTemp as string, `buildSummary_${runId as string}.json`);
const data = await readJsonFile(filePath);
const taskSummaryTableRows = getBuildSummaryTable(data);
writeSummary(taskSummaryTableRows);
Expand Down
1 change: 0 additions & 1 deletion src/buildSummary.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as core from '@actions/core';

jest.mock('@actions/core', () => ({
summary: {
addHeading: jest.fn().mockReturnThis(),
addTable: jest.fn().mockReturnThis(),
write: jest.fn().mockReturnThis(),
},
Expand Down

0 comments on commit b83d97c

Please sign in to comment.