Skip to content

Commit 8147085

Browse files
committed
✨ Improves bug issue Discord notifications
* Refines the logic for triggering Discord notifications for bug issues. It now checks for the presence of "bug" labels or a hidden marker, in addition to the existing form-based check. * Simplifies the "Skip Discord" check to be more inclusive and less sensitive to formatting variations. * Improves the formatting of the Discord message, making it more readable.
1 parent 36c03a9 commit 8147085

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,17 @@ jobs:
99
notify_discord:
1010
runs-on: ubuntu-latest
1111

12-
# Run only for Bug-form issues AND when "Skip notify Discord" is NOT checked
13-
if: ${{ contains(github.event.issue.body, '### Steps to reproduce') && !contains(github.event.issue.body, '- [x] Skip notify Discord') && !contains(github.event.issue.body, '- [X] Skip notify Discord') }}
12+
# Run only for Bug issues (typed/label/hidden marker) and when the form didn't opt out of Discord
13+
if: >
14+
${{
15+
(
16+
(github.event.issue.issue_type && github.event.issue.issue_type.name == 'Bug') ||
17+
contains(github.event.issue.labels.*.name, 'bug') ||
18+
contains(github.event.issue.labels.*.name, 'Bug') ||
19+
contains(github.event.issue.body, 'issue-type=bug')
20+
)
21+
&& !contains(github.event.issue.body, 'Skip Discord')
22+
}}
1423
1524
steps:
1625
- name: Send Discord notification
@@ -32,7 +41,15 @@ jobs:
3241
--arg username "GitHub Bot" \
3342
--arg content "" \
3443
--arg title "🐞 New Bug issue in $REPO_NAME" \
35-
--arg desc "**#${ISSUE_NUMBER} – $ISSUE_TITLE**\n**Author:** $ISSUE_USER\n**Link:** $ISSUE_URL\n\n**Description (truncated):**\n$SHORT_BODY" \
44+
--arg desc "$(cat <<EOF
45+
**#${ISSUE_NUMBER} – $ISSUE_TITLE**
46+
**Author:** $ISSUE_USER
47+
**Link:** $ISSUE_URL
48+
49+
**Description (truncated):**
50+
$SHORT_BODY
51+
EOF
52+
)" \
3653
'{
3754
"username": $username,
3855
"content": $content,
@@ -42,7 +59,8 @@ jobs:
4259
"description": $desc
4360
}
4461
]
45-
}')
62+
}'
63+
)
4664
4765
curl -X POST \
4866
-H "Content-Type: application/json" \

0 commit comments

Comments
 (0)