Skip to content

Commit

Permalink
test summary
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamkrishnar committed Sep 8, 2024
1 parent ee8b542 commit 0c460ce
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
17 changes: 16 additions & 1 deletion dist/blog-post-workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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);
}
Expand Down
17 changes: 16 additions & 1 deletion src/blog-post-workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 0c460ce

Please sign in to comment.