Skip to content

Commit

Permalink
chore: Fix discord message response
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Apr 22, 2024
1 parent 28fd233 commit c75e9d9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions .github/actions/discord-message/action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const formatBody = (input) => {
return `Submitted by [${text}](${url})`;
})
.replace(markdownLinkRe, (_match, text, url) => `[${text}](<${url}>)`)
.replace(repeatedNewlineRe, (_match, text) => text || '\n')
.replace(repeatedNewlineRe, (_match, text) => text ? ` ${text}` : '\n')
.trim();
};

Expand Down Expand Up @@ -61,7 +61,7 @@ async function main() {
.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',
Expand All @@ -72,10 +72,7 @@ async function main() {
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);

0 comments on commit c75e9d9

Please sign in to comment.