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 407b67f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
19 changes: 18 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: "6" }, { 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([
{ data: `[${runnerNameArray[index]}](${runnerNameArray[index]})`, colspan: "6" },
{ data: ":white_check_mark:" },
{ data: `${result.value.length}` },
{ data: "<code> Runner succeeded </code>", 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,16 @@ var runWorkflow = async () => {
true
);
core.info(message.toString());
core.summary.addRaw(`### Summary
${message.toString()}`, true);
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.addRaw(`### Summary
${noChangeMessage}`, true);
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: '6'}, {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([
{data: `[${runnerNameArray[index]}](${runnerNameArray[index]})`, colspan: '6'},
{data: ':white_check_mark:'},
{data: `${result.value.length}`},
{data: '<code> Runner succeeded </code>', 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.addRaw(`### Summary \n ${message.toString()}`, true);
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.addRaw(`### Summary \n ${noChangeMessage}`, true);
await core.summary.write();
}
process.exit(jobFailFlag ? 1 : 0);
}
Expand Down

0 comments on commit 407b67f

Please sign in to comment.