fix: escape special characters in commit message for NTFY
All checks were successful
NTFY Notification / notify (push) Successful in 6s

Use shell variables to properly handle multi-line commit messages
and special characters that cause shell parsing errors.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-02-04 13:02:05 +08:00
parent 880659273e
commit b5011743a9

View File

@@ -7,12 +7,21 @@ jobs:
steps: steps:
- name: Send to NTFY - name: Send to NTFY
run: | run: |
curl -d "🚀 ${{ github.repository_name }} REPO="${{ github.repository_name }}"
New commit ${{ github.sha }} SHA="${{ github.sha }}"
MSG="${{ github.event.head_commit.message }}"
AUTHOR="${{ github.actor }}"
BRANCH="${{ github.ref_name }}"
# 将多行消息替换为空格避免shell解析错误
MSG=$(echo "$MSG" | tr '\n' ' ' | sed 's/"/\\"/g')
curl -d "🚀 $REPO
New commit $SHA
📝 Message 📝 Message
${{ github.event.head_commit.message }} $MSG
👤 Author: ${{ github.actor }} 👤 Author: $AUTHOR
🌿 Branch: ${{ github.ref_name }}" \ 🌿 Branch: $BRANCH" \
-H "Title: Git Push Notification" \ -H "Title: Git Push Notification" \
-H "Priority: default" \ -H "Priority: default" \
-H "Tags: gitea,push,${{ github.repository_name }}" \ -H "Tags: gitea,push,${{ github.repository_name }}" \