Skip to content

Commit 62f03b5

Browse files
committed
✨ Improves Discord issue reporting
- Trims the issue body to prevent overly long Discord messages. - Enhances payload construction for Discord notifications. - Clarifies the workflow's conditional execution logic.
1 parent 44c29d5 commit 62f03b5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.github/workflows/issue-bug-to-discord.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ name: Report Bug-type issues to Discord
22

33
on:
44
issues:
5-
types: [opened]
5+
types:
6+
- opened
67

78
jobs:
89
notify_discord:
910
runs-on: ubuntu-latest
1011

11-
# Run only for Bug issues AND when Skip notify Discord is NOT checked
12-
if: ${{
13-
contains(github.event.issue.body, 'issue-type=bug') &&
14-
!contains(github.event.issue.body, '- [x] Skip notify Discord')
15-
}}
12+
# Run only for Bug issues AND when "Skip notify Discord" is NOT checked
13+
if: ${{ contains(github.event.issue.body, 'issue-type=bug') && !contains(github.event.issue.body, '- [x] Skip notify Discord') }}
1614

1715
steps:
1816
- name: Send Discord notification
@@ -25,9 +23,11 @@ jobs:
2523
ISSUE_USER: ${{ github.event.issue.user.login }}
2624
REPO_NAME: ${{ github.repository }}
2725
run: |
26+
# Trim body to avoid huge messages
2827
SHORT_BODY=$(printf '%s' "$ISSUE_BODY" | head -c 400)
2928
[ -z "$SHORT_BODY" ] && SHORT_BODY="(no description)"
3029
30+
# Build JSON payload for Discord
3131
payload=$(jq -n \
3232
--arg username "GitHub Bot" \
3333
--arg content "" \

0 commit comments

Comments
 (0)