This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Report Bug-type issues to Discord | |
| on: | |
| issues: | |
| types: [opened] | |
| jobs: | |
| notify_discord: | |
| runs-on: ubuntu-latest | |
| # Only run for issues whose type is "Bug" | |
| if: github.event.issue.issue_type == 'Bug' | |
| steps: | |
| - name: Send Discord notification | |
| env: | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| ISSUE_TITLE: ${{ github.event.issue.title }} | |
| ISSUE_URL: ${{ github.event.issue.html_url }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| ISSUE_BODY: ${{ github.event.issue.body }} | |
| ISSUE_USER: ${{ github.event.issue.user.login }} | |
| REPO_NAME: ${{ github.repository }} | |
| run: | | |
| # Trim body to avoid huge messages | |
| SHORT_BODY=$(printf '%s' "$ISSUE_BODY" | head -c 400) | |
| [ -z "$SHORT_BODY" ] && SHORT_BODY="(no description)" | |
| # Build JSON payload for Discord | |
| payload=$(jq -n \ | |
| --arg username "GitHub Bot" \ | |
| --arg content "" \ | |
| --arg title "π New Bug issue in $REPO_NAME" \ | |
| --arg desc "**#${ISSUE_NUMBER} β $ISSUE_TITLE**\n"\ | |
| "**Author:** $ISSUE_USER\n"\ | |
| "**Link:** $ISSUE_URL\n\n"\ | |
| "**Description (truncated):**\n$SHORT_BODY" \ | |
| '{ | |
| "username": $username, | |
| "content": $content, | |
| "embeds": [ | |
| { | |
| "title": $title, | |
| "description": $desc | |
| } | |
| ] | |
| }') | |
| curl -X POST \ | |
| -H "Content-Type: application/json" \ | |
| -d "$payload" \ | |
| "$DISCORD_WEBHOOK_URL" |