diff --git a/notify.sh b/notify.sh index 35c8d60..87648a8 100644 --- a/notify.sh +++ b/notify.sh @@ -96,6 +96,15 @@ send_gmail() { status_text="FAILURE" fi + # Parse structured message data + local branch=$(echo "$MESSAGE" | grep -oP '^Branch:\s*\K.*' || echo "") + local commit=$(echo "$MESSAGE" | grep -oP '^Commit:\s*\K.*' || echo "") + local commit_msg=$(echo "$MESSAGE" | grep -oP '^Message:\s*\K.*' || echo "") + local actor=$(echo "$MESSAGE" | grep -oP '^Actor:\s*\K.*' || echo "") + + # Shorten commit hash for display + local commit_short="${commit:0:8}" + # Build modern HTML email with inline CSS local html_body=$(cat < @@ -126,39 +135,72 @@ send_gmail() { - + -

$TITLE

+

${GITHUB_REPOSITORY:-Repository}

- + -
-

$MESSAGE

-
+ + + + + + + + + + + + + + + + + + + + +
+
+
🌿 Branch
+
$branch
+
+
+
+
🔖 Commit
+
$commit_short
+
+
+
+
💬 Commit Message
+
$commit_msg
+
+
+
+
👤 Author
+
$actor
+
+
- +
- - -
- Repository: ${GITHUB_REPOSITORY:-N/A} + 🔢 Run ID: ${GITHUB_RUN_ID:-N/A}
- Run ID: ${GITHUB_RUN_ID:-N/A} -
- Timestamp: $(date -u +"%Y-%m-%d %H:%M:%S UTC") + ⏰ Timestamp: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
@@ -168,8 +210,8 @@ send_gmail() { - - View Deployment Logs + + 📋 View Deployment Logs @@ -178,7 +220,7 @@ send_gmail() {

- Automated deployment notification from ${GITHUB_REPOSITORY:-Your Repository} + 🤖 Automated deployment notification from Act Runner

@@ -203,6 +245,7 @@ Content-Type: multipart/alternative; boundary="$boundary" --$boundary Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit $ICON $TITLE @@ -217,6 +260,7 @@ View logs: $GIT_URL/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} --$boundary Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 8bit $html_body --$boundary-- @@ -225,7 +269,7 @@ EOF # Send email via SMTP echo -e " ${YELLOW}→${NC} Sending HTML email..." - response=$(echo "$email_content" | curl --ssl-reqd \ + response=$(printf "%s" "$email_content" | curl --ssl-reqd \ --url "smtp://smtp.gmail.com:587" \ --user "$GMAIL_USER:$GMAIL_PASS" \ --mail-from "$GMAIL_USER" \