All checks were successful
NTFY Notification / notify (push) Successful in 3s
Use github.repository and parse with cut command since github.repository_name is not available in Gitea Actions. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
32 lines
989 B
YAML
32 lines
989 B
YAML
name: NTFY Notification
|
||
on: [push]
|
||
|
||
jobs:
|
||
notify:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Send to NTFY
|
||
run: |
|
||
FULL_REPO="${{ github.repository }}"
|
||
# 从 owner/repo 格式中提取仓库名称
|
||
REPO=$(echo "$FULL_REPO" | cut -d'/' -f2)
|
||
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,$REPO" \
|
||
-H "Authorization: Bearer ${{ secrets.NTFY_TOKEN }}" \
|
||
https://ntfy.server10086.icu/gitea
|