Skip to content
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
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ jobs:
shell: bash
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
COMMIT_MSG: ${{ github.event.head_commit.message }}
run: |
if [ -z "$DISCORD_WEBHOOK_URL" ]; then
echo "DISCORD_WEBHOOK_URL not configured, skipping."
Expand Down Expand Up @@ -283,6 +284,14 @@ jobs:
SHA="${{ github.sha }}"
SHORT_SHA="${SHA:0:7}"

# Discord caps embed field values at 1024 chars. Use only the commit
# subject (first line) and truncate it so the payload is never rejected
# with HTTP 400 on long, multi-line (e.g. squash-merged) messages.
COMMIT_SUBJECT=$(printf '%s' "$COMMIT_MSG" | head -n 1)
if [ "${#COMMIT_SUBJECT}" -gt 256 ]; then
COMMIT_SUBJECT="${COMMIT_SUBJECT:0:253}..."
fi

PAYLOAD=$(jq -n \
--arg title "vMenu (v${DISPLAY_VERSION})" \
--arg desc "$STATUS_TEXT" \
Expand All @@ -294,7 +303,7 @@ jobs:
--arg link_url "$LINK_URL" \
--arg short_sha "$SHORT_SHA" \
--arg commit_url "https://github.com/${{ github.repository }}/commit/${{ github.sha }}" \
--arg commit_msg "${{ github.event.head_commit.message }}" \
--arg commit_msg "$COMMIT_SUBJECT" \
'{
embeds: [{
title: $title,
Expand Down
Loading