File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -246,6 +246,7 @@ jobs:
246246 shell : bash
247247 env :
248248 DISCORD_WEBHOOK_URL : ${{ secrets.DISCORD_WEBHOOK_URL }}
249+ COMMIT_MSG : ${{ github.event.head_commit.message }}
249250 run : |
250251 if [ -z "$DISCORD_WEBHOOK_URL" ]; then
251252 echo "DISCORD_WEBHOOK_URL not configured, skipping."
@@ -283,6 +284,14 @@ jobs:
283284 SHA="${{ github.sha }}"
284285 SHORT_SHA="${SHA:0:7}"
285286
287+ # Discord caps embed field values at 1024 chars. Use only the commit
288+ # subject (first line) and truncate it so the payload is never rejected
289+ # with HTTP 400 on long, multi-line (e.g. squash-merged) messages.
290+ COMMIT_SUBJECT=$(printf '%s' "$COMMIT_MSG" | head -n 1)
291+ if [ "${#COMMIT_SUBJECT}" -gt 256 ]; then
292+ COMMIT_SUBJECT="${COMMIT_SUBJECT:0:253}..."
293+ fi
294+
286295 PAYLOAD=$(jq -n \
287296 --arg title "vMenu (v${DISPLAY_VERSION})" \
288297 --arg desc "$STATUS_TEXT" \
@@ -294,7 +303,7 @@ jobs:
294303 --arg link_url "$LINK_URL" \
295304 --arg short_sha "$SHORT_SHA" \
296305 --arg commit_url "https://github.com/${{ github.repository }}/commit/${{ github.sha }}" \
297- --arg commit_msg "${{ github.event.head_commit.message }} " \
306+ --arg commit_msg "$COMMIT_SUBJECT " \
298307 '{
299308 embeds: [{
300309 title: $title,
You can’t perform that action at this time.
0 commit comments