Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 00e0108

Browse files
authored
Update feature-launcher.yml (#1095)
1 parent 94f5bb7 commit 00e0108

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

.github/workflows/feature-launcher.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,51 @@ jobs:
1212
- name: Send Feature Release Notification to Discord
1313
env:
1414
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
15+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
1516
ISSUE_TITLE: ${{ github.event.issue.title }}
1617
ISSUE_BODY: ${{ github.event.issue.body }}
1718
ISSUE_URL: ${{ github.event.issue.html_url }}
1819
run: |
19-
curl -H "Content-Type: application/json" \
20-
-X POST \
21-
-d '{
22-
"content": "**🚀 New Feature Launched!**\n\n🎉 *${{ env.ISSUE_TITLE }}* is now available to try!\n📖 Description: ${{ env.ISSUE_BODY }}\n🔗 [Check it out here](${{ env.ISSUE_URL }})"
23-
}' \
24-
$DISCORD_WEBHOOK
20+
node -e '
21+
const https = require("https");
22+
const discordWebhook = new URL(process.env.DISCORD_WEBHOOK);
23+
const slackWebhook = new URL(process.env.SLACK_WEBHOOK);
24+
25+
const issueTitle = process.env.ISSUE_TITLE;
26+
const issueBody = process.env.ISSUE_BODY;
27+
const issueUrl = process.env.ISSUE_URL;
28+
29+
// Discord Payload
30+
const discordPayload = {
31+
content: [
32+
"**🚀 " +issueTitle + " has been released!**",
33+
"",
34+
"**🌟 Whats new in CodeGate:**",
35+
issueBody,
36+
"",
37+
"We would 🤍 your feedback! 🔗 [Here’s the GitHub issue](" + issueUrl + ")"
38+
].join("\n")
39+
};
40+
41+
// Slack Payload
42+
const slackPayload = {
43+
text: `🚀 *${issueTitle}* has been released!\n\n 🔗 <${issueUrl}|Here’s the GitHub issue>`,
44+
};
45+
46+
function sendNotification(webhookUrl, payload) {
47+
const url = new URL(webhookUrl);
48+
const req = https.request(url, {
49+
method: "POST",
50+
headers: {
51+
"Content-Type": "application/json",
52+
}
53+
});
54+
55+
req.on("error", (error) => {
56+
console.error("Error:", error);
57+
process.exit(1);
58+
});
59+
60+
req.write(JSON.stringify(payload));
61+
req.end();
62+
}

0 commit comments

Comments
 (0)