···
const updatedDepsRe = /\n-\s*Updated dependencies[\s\S]+\n(\n\s+-[\s\S]+)*/gi;
const markdownLinkRe = /\[([^\]]+)\]\(([^\)]+)\)/g;
const creditRe = new RegExp(`Submitted by (?:undefined|${markdownLinkRe.source})`, 'ig');
14
-
const repeatedNewlineRe = /(\n[ ]*)+/g;
14
+
const repeatedNewlineRe = /(?:\n[ ]*)*(\n[ ]*)/g;
.replace(updatedDepsRe, '')
···
if (!text || /@kitten|@JoviDeCroock/i.test(text)) return '';
return `Submitted by [${text}](${url})`;
22
-
.replace(markdownLinkRe, (_match, text, url) => {
23
-
return `[${text}](<${url}>)`;
25
-
.replace(repeatedNewlineRe, '\n')
22
+
.replace(markdownLinkRe, (_match, text, url) => `[${text}](<${url}>)`)
23
+
.replace(repeatedNewlineRe, (_match, text) => text ? ` ${text}` : '\n')
···
// Send message through a discord webhook or bot
66
-
const response = fetch(WEBHOOK_URL, {
64
+
const response = await fetch(WEBHOOK_URL, {
'Content-Type': 'application/json',
···
console.error('Something went wrong while sending the discord webhook.', response.status);
console.error(await response.text());
main().then().catch(console.error);