name: NTFY Notification on: [push] jobs: notify: runs-on: ubuntu-latest steps: - name: Send to NTFY run: | 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 $MSG 👤 Author: $AUTHOR 🌿 Branch: $BRANCH" \ -H "Title: Git Push Notification" \ -H "Priority: default" \ -H "Tags: gitea,push,${{ github.repository_name }}" \ -H "Authorization: Bearer ${{ secrets.NTFY_TOKEN }}" \ https://ntfy.server10086.icu/gitea