fix: escape special characters in commit message for NTFY
All checks were successful
NTFY Notification / notify (push) Successful in 6s
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:
@@ -7,12 +7,21 @@ jobs:
|
||||
steps:
|
||||
- name: Send to NTFY
|
||||
run: |
|
||||
curl -d "🚀 ${{ github.repository_name }}
|
||||
New commit ${{ github.sha }}
|
||||
REPO="${{ github.repository_name }}"
|
||||
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
|
||||
${{ github.event.head_commit.message }}
|
||||
👤 Author: ${{ github.actor }}
|
||||
🌿 Branch: ${{ github.ref_name }}" \
|
||||
$MSG
|
||||
👤 Author: $AUTHOR
|
||||
🌿 Branch: $BRANCH" \
|
||||
-H "Title: Git Push Notification" \
|
||||
-H "Priority: default" \
|
||||
-H "Tags: gitea,push,${{ github.repository_name }}" \
|
||||
|
||||
Reference in New Issue
Block a user