Skip to content

Commit

Permalink
Try axios
Browse files Browse the repository at this point in the history
  • Loading branch information
theballaam96 committed Jan 14, 2024
1 parent 87a4b34 commit d2c84b4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/scripts/pr-poster.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async function run() {
}
);
} else {
let content = "";

const information = {
"Pull Request Link": `https://github.com/${repo}/pull/${prNumber}`,
}
Expand All @@ -162,10 +162,14 @@ async function run() {
embeds: embeds_arr,
}
const webhookUrl = process.env.DISCORD_WEBHOOK;
var request = new XMLHttpRequest();
request.open("POST", webhookUrl);
request.setRequestHeader('Content-type', 'application/json');
request.send(JSON.stringify(params));
axios.post(webhookUrl, options)
.then(whresp => {
console.log('Message sent successfully:', whresp.data);
})
.catch(wherr => {
console.error('Error sending message:', wherr.message);
process.exit(1);
});
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message || error);
process.exit(1);
Expand Down

0 comments on commit d2c84b4

Please sign in to comment.