From 8122d5d80a71800f1fe82938f2a343afa6a8e23e Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Fri, 13 Mar 2026 20:05:22 -0300 Subject: [PATCH] feat: add Discord notification workflow for new issues --- .github/workflows/discord-issues.yml | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/discord-issues.yml diff --git a/.github/workflows/discord-issues.yml b/.github/workflows/discord-issues.yml new file mode 100644 index 00000000..d06f0f35 --- /dev/null +++ b/.github/workflows/discord-issues.yml @@ -0,0 +1,56 @@ +name: Discord โ€” New Issue Notification + +on: + issues: + types: [opened] + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Send issue to Discord + uses: actions/github-script@v7 + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_ISSUES }} + with: + script: | + const webhook = process.env.DISCORD_WEBHOOK; + const issue = context.payload.issue; + + const body = (issue.body || '').slice(0, 300) + ((issue.body || '').length > 300 ? '...' : ''); + const labels = issue.labels.length + ? issue.labels.map(l => `\`${l.name}\``).join(', ') + : '*(none)*'; + + const payload = { + content: '@everyone ๐Ÿ“ข **New issue reported on Velxio!**', + embeds: [{ + title: `๐Ÿ› Issue #${issue.number}: ${issue.title}`, + url: issue.html_url, + description: body || '*(no description)*', + color: 0xE74C3C, + fields: [ + { name: '๐Ÿ“ฆ Repository', value: `[\`${context.repo.owner}/${context.repo.repo}\`](https://github.com/${context.repo.owner}/${context.repo.repo})`, inline: true }, + { name: '๐Ÿท๏ธ Labels', value: labels, inline: true } + ], + author: { + name: issue.user.login, + url: `https://github.com/${issue.user.login}`, + icon_url: issue.user.avatar_url + }, + footer: { text: 'Velxio ยท GitHub Issues' }, + timestamp: issue.created_at + }] + }; + + const res = await fetch(webhook, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(payload) + }); + + console.log(`Discord response: ${res.status}`); + if (!res.ok) { + const text = await res.text(); + core.setFailed(`Discord webhook failed ${res.status}: ${text}`); + }