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

Update feature-launcher.yml #1095

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 44 additions & 6 deletions .github/workflows/feature-launcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,51 @@ jobs:
- name: Send Feature Release Notification to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
ISSUE_URL: ${{ github.event.issue.html_url }}
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"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 }})"
}' \
$DISCORD_WEBHOOK
node -e '
const https = require("https");
const discordWebhook = new URL(process.env.DISCORD_WEBHOOK);
const slackWebhook = new URL(process.env.SLACK_WEBHOOK);

const issueTitle = process.env.ISSUE_TITLE;
const issueBody = process.env.ISSUE_BODY;
const issueUrl = process.env.ISSUE_URL;

// Discord Payload
const discordPayload = {
content: [
"**🚀 " +issueTitle + " has been released!**",
"",
"**🌟 Whats new in CodeGate:**",
issueBody,
"",
"We would 🤍 your feedback! 🔗 [Here’s the GitHub issue](" + issueUrl + ")"
].join("\n")
};

// Slack Payload
const slackPayload = {
text: `🚀 *${issueTitle}* has been released!\n\n 🔗 <${issueUrl}|Here’s the GitHub issue>`,
};

function sendNotification(webhookUrl, payload) {
const url = new URL(webhookUrl);
const req = https.request(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
}
});

req.on("error", (error) => {
console.error("Error:", error);
process.exit(1);
});

req.write(JSON.stringify(payload));
req.end();
}