Skip to content

Commit 4492dc5

Browse files
DenysBielovclaude
andcommitted
feat: add separator lines between header, body, and link in Telegram notifications
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 87fb18a commit 4492dc5

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

actions/telegram-notify/action.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,25 @@ runs:
181181
esac
182182
fi
183183
184-
# Compose message: header (if new/updated) + previous lines + new line + link
184+
# Compose message: header + separator + body lines + separator + link
185+
SEP="———"
185186
LINK="<a href=\"${GITHUB_RUN_URL}\">🔗 View Run</a>"
186187
if [ -n "$HEADER" ] && [ -n "$PREV" ]; then
187-
BODY_LINES=$(echo "$PREV" | tail -n +2 | grep -v '🔗 View Run' || true)
188-
MSG=$(printf '%s\n%s\n%s\n%s' "$HEADER" "$BODY_LINES" "$LINE" "$LINK")
188+
BODY_LINES=$(echo "$PREV" | tail -n +2 | grep -v '🔗 View Run' | grep -v "^${SEP}$" || true)
189+
MSG=$(printf '%s\n%s\n%s\n%s\n%s\n%s' "$HEADER" "$SEP" "$BODY_LINES" "$LINE" "$SEP" "$LINK")
189190
elif [ -n "$HEADER" ]; then
190-
MSG=$(printf '%s\n%s\n%s' "$HEADER" "$LINE" "$LINK")
191+
MSG=$(printf '%s\n%s\n%s\n%s\n%s' "$HEADER" "$SEP" "$LINE" "$SEP" "$LINK")
191192
elif [ -n "$PREV" ]; then
192-
BODY=$(echo "$PREV" | grep -v '🔗 View Run' || true)
193-
MSG=$(printf '%s\n%s\n%s' "$BODY" "$LINE" "$LINK")
193+
PREV_CLEAN=$(echo "$PREV" | grep -v '🔗 View Run' | grep -v "^${SEP}$" || true)
194+
PREV_HEADER=$(echo "$PREV_CLEAN" | head -1)
195+
PREV_BODY=$(echo "$PREV_CLEAN" | tail -n +2 || true)
196+
if [ -n "$PREV_BODY" ]; then
197+
MSG=$(printf '%s\n%s\n%s\n%s\n%s\n%s' "$PREV_HEADER" "$SEP" "$PREV_BODY" "$LINE" "$SEP" "$LINK")
198+
else
199+
MSG=$(printf '%s\n%s\n%s\n%s\n%s' "$PREV_HEADER" "$SEP" "$LINE" "$SEP" "$LINK")
200+
fi
194201
else
195-
MSG=$(printf '%s\n%s' "$LINE" "$LINK")
202+
MSG=$(printf '%s\n%s\n%s' "$LINE" "$SEP" "$LINK")
196203
fi
197204
198205
# Clean up: remove empty lines

0 commit comments

Comments
 (0)