Skip to content

Commit

Permalink
Testing JSON parse
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhoski committed May 22, 2024
1 parent 6f4205f commit 8e69c86
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,27 @@ export async function readJsonFile(filePath: string): Promise<TaskList> {
}

export function addBuildSummaryTable(tasks: TaskList): void {
const header: string[] = ['Task Name', 'Status', 'Description', 'Duration (HH:MM:SS)'];
console.log("Task Details:");
let arrayOfStringArrays: string[][] = [];
arrayOfStringArrays.push(header);
tasks.taskDetails.forEach((task, index) => {
let taskDetails: string[] = [];
console.log(`Task ${index + 1}:`);
taskDetails.push(`${task.name}`);
if (`${task.failed}` === 'true') {
taskDetails.push('FAILED');
} else if (`${task.skipped}` === 'true') {
taskDetails.push('SKIPPED');
} else {
taskDetails.push('PASSED');
}
taskDetails.push(`${task.description}`)
taskDetails.push(`${task.duration}`);
const header: string[] = ['Task Name', 'Status', 'Description', 'Duration (HH:MM:SS)'];
let taskSummaryTableRows: string[][] = [header];

tasks.taskDetails.forEach((task, index) => {
let taskDetails: string[] = [];
taskDetails.push(task.name);
if (task.failed) {
taskDetails.push('FAILED');
} else if (task.skipped) {
taskDetails.push('SKIPPED');
} else {
taskDetails.push('PASSED');
}
taskDetails.push(task.description);
taskDetails.push(task.duration);

arrayOfStringArrays.push(taskDetails);
});
taskSummaryTableRows.push(taskDetails);
});

core.summary
.addHeading('MATLAB Build Results')
.addTable(arrayOfStringArrays)
.write()
.addHeading('MATLAB Build Results')
.addTable(taskSummaryTableRows)
.write();
}

0 comments on commit 8e69c86

Please sign in to comment.