From 0c460ce7db6549ea7fabbff79f9e6127f29469f5 Mon Sep 17 00:00:00 2001 From: Gautam Krishna R Date: Sun, 8 Sep 2024 09:19:01 +0530 Subject: [PATCH] test summary --- dist/blog-post-workflow.js | 17 ++++++++++++++++- src/blog-post-workflow.js | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/dist/blog-post-workflow.js b/dist/blog-post-workflow.js index 3c89bf6..9415056 100644 --- a/dist/blog-post-workflow.js +++ b/dist/blog-post-workflow.js @@ -13763,6 +13763,9 @@ var parser = new Parser({ item: [...customTagArgs] } }); +var summaryTable = [ + [{ header: true, data: "Website", colspan: "4" }, { header: true, data: "Status" }, { header: true, data: "Post Count" }, { header: true, data: "Log", colspan: "6" }] +]; feedList.forEach((siteUrl) => { runnerNameArray.push(siteUrl); promiseArray.push(new Promise((resolve, reject) => { @@ -13854,6 +13857,12 @@ var runWorkflow = async () => { results.forEach((result, index) => { if (result.status === "fulfilled") { core.info(runnerNameArray[index] + " runner succeeded. Post count: " + result.value.length); + summaryTable.push([ + { header: true, data: `\`${runnerNameArray[index]}\``, colspan: "4" }, + { header: true, data: ":white_check_mark:" }, + { header: true, data: `${result.value.length}` }, + { header: true, data: "`Runner succeeded`", colspan: "6" } + ]); if (typeof feedNamesList[index] !== void 0 && feedNamesList[index]) { result.value = result.value.map((item2) => { item2.feedName = feedNamesList[index]; @@ -13960,8 +13969,14 @@ var runWorkflow = async () => { true ); core.info(message.toString()); + core.summary.addDetails("Summary", message.toString()); + core.summary.addTable(summaryTable); + await core.summary.write(); } else { - core.info("No change detected, skipping"); + const noChangeMessage = "No change detected, skipping"; + core.info(noChangeMessage); + core.summary.addDetails("Summary", noChangeMessage); + await core.summary.write(); } process.exit(jobFailFlag ? 1 : 0); } diff --git a/src/blog-post-workflow.js b/src/blog-post-workflow.js index 5940756..aa0f628 100644 --- a/src/blog-post-workflow.js +++ b/src/blog-post-workflow.js @@ -111,6 +111,10 @@ let parser = new Parser({ } }); +const summaryTable = [ + [{header: true, data: 'Website', colspan: '4'}, {header: true, data: 'Status'}, {header: true, data: 'Post Count'}, {header: true, data: 'Log', colspan: '6'}] +]; + // Generating promise array feedList.forEach((siteUrl) => { runnerNameArray.push(siteUrl); @@ -228,6 +232,11 @@ const runWorkflow = async () => { if (result.status === 'fulfilled') { // Succeeded core.info(runnerNameArray[index] + ' runner succeeded. Post count: ' + result.value.length); + summaryTable.push([ + {header: true, data: `\`${runnerNameArray[index]}\``, colspan: '4'}, + {header: true, data: ':white_check_mark:'}, + {header: true, data: `${result.value.length}`}, + {header: true, data: '`Runner succeeded`', colspan: '6'}]); // Adds feed name to the items if (typeof feedNamesList[index] !== undefined && feedNamesList[index]) { result.value = result.value.map((item) => { @@ -371,8 +380,14 @@ const runWorkflow = async () => { const message = await keepaliveWorkflow.KeepAliveWorkflow(GITHUB_TOKEN, committerUsername, committerEmail, core.getInput('dummy_commit_message'), 50, true); core.info(message.toString()); + core.summary.addDetails('Summary', message.toString()); + core.summary.addTable(summaryTable); + await core.summary.write(); } else { - core.info('No change detected, skipping'); + const noChangeMessage = 'No change detected, skipping'; + core.info(noChangeMessage); + core.summary.addDetails('Summary', noChangeMessage); + await core.summary.write(); } process.exit(jobFailFlag ? 1 : 0); }