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

Configure Feed

Select the types of activity you want to include in your feed.

chore: Fix discord message output

+4 -9
+4 -9
.github/actions/discord-message/action.mjs
··· 11 11 const updatedDepsRe = /\n-\s*Updated dependencies[\s\S]+\n(\n\s+-[\s\S]+)*/gi; 12 12 const markdownLinkRe = /\[([^\]]+)\]\(([^\)]+)\)/g; 13 13 const creditRe = new RegExp(`Submitted by (?:undefined|${markdownLinkRe.source})`, 'ig'); 14 - const repeatedNewlineRe = /(\n[ ]*)+/g; 14 + const repeatedNewlineRe = /(?:\n[ ]*)*(\n[ ]*)/g; 15 15 return input 16 16 .replace(titleRe, '') 17 17 .replace(updatedDepsRe, '') ··· 19 19 if (!text || /@kitten|@JoviDeCroock/i.test(text)) return ''; 20 20 return `Submitted by [${text}](${url})`; 21 21 }) 22 - .replace(markdownLinkRe, (_match, text, url) => { 23 - return `[${text}](<${url}>)`; 24 - }) 25 - .replace(repeatedNewlineRe, '\n') 22 + .replace(markdownLinkRe, (_match, text, url) => `[${text}](<${url}>)`) 23 + .replace(repeatedNewlineRe, (_match, text) => text ? ` ${text}` : '\n') 26 24 .trim(); 27 25 }; 28 26 ··· 63 61 .join('\n\n'); 64 62 65 63 // Send message through a discord webhook or bot 66 - const response = fetch(WEBHOOK_URL, { 64 + const response = await fetch(WEBHOOK_URL, { 67 65 method: 'POST', 68 66 headers: { 69 67 'Content-Type': 'application/json', ··· 74 72 if (!response.ok) { 75 73 console.error('Something went wrong while sending the discord webhook.', response.status); 76 74 console.error(await response.text()); 77 - return; 78 75 } 79 - 80 - return response; 81 76 } 82 77 83 78 main().then().catch(console.error);