Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.

chore: Fix discord message output

Changed files
+4 -9
.github
actions
discord-message
+4 -9
.github/actions/discord-message/action.mjs
···
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');
-
const repeatedNewlineRe = /(\n[ ]*)+/g;
+
const repeatedNewlineRe = /(?:\n[ ]*)*(\n[ ]*)/g;
return input
.replace(titleRe, '')
.replace(updatedDepsRe, '')
···
if (!text || /@kitten|@JoviDeCroock/i.test(text)) return '';
return `Submitted by [${text}](${url})`;
})
-
.replace(markdownLinkRe, (_match, text, url) => {
-
return `[${text}](<${url}>)`;
-
})
-
.replace(repeatedNewlineRe, '\n')
+
.replace(markdownLinkRe, (_match, text, url) => `[${text}](<${url}>)`)
+
.replace(repeatedNewlineRe, (_match, text) => text ? ` ${text}` : '\n')
.trim();
};
···
.join('\n\n');
// Send message through a discord webhook or bot
-
const response = fetch(WEBHOOK_URL, {
+
const response = await fetch(WEBHOOK_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
···
if (!response.ok) {
console.error('Something went wrong while sending the discord webhook.', response.status);
console.error(await response.text());
-
return;
}
-
-
return response;
}
main().then().catch(console.error);