Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions WordpressSync/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ const doProcessEndpoints = async work => {
if (endpoint.ReportingChannel_Slack && slackBotGetToken()) {
//Endpoint reporting channel enabled. Add a post for each commit report.
if (commitReports?.length) {
let opCount = 0;

/** @type {string[]} */
let mergeFileNames = [];
commitReports.map(x => {
commitReports.forEach(x => {
opCount += x.Files.length;

mergeFileNames.push(
...x.Files.map(
//Remove file extension, and remove resolution postfix
Expand All @@ -113,17 +117,25 @@ const doProcessEndpoints = async work => {
{ username: endpoint.name }
);

const allfileNames = [...new Set(mergeFileNames)];
const slugList = ` : _${[...new Set(mergeFileNames)].join(", ")}_`;

await slackBot.Chat(`_${allfileNames.join(", ")}_`);
await slackBot.Chat(
`${opCount} changes${slugList.length < 300 ? slugList : "."}`
);

for (const commitReport of commitReports) {
const fileData = commitReport.Files.map(
x => `• ${x.status} - _${x.filename.split("/").slice(-1)[0]}_`
).join("\n");

await slackBot.Reply(
`<${commitReport.Commit.html_url}|${commitReport.Commit.message}>\n${fileData}`
`<${commitReport.Commit.html_url}|${
commitReport.Commit.message
}>\n${
commitReport.Files.length > 1
? `${commitReport.Files.length} changes\n`
: ""
}${fileData}`
);
}
}
Expand Down