ci(workflow): simplify WeChat notification payload generation
- Rename workflow from "Release Notify (Ali AI Final)" to "Release Notify Workflow" for clarity - Replace jq multi-line argument construction with printf for better readability - Simplify payload generation by building content string separately before passing to jq - Reduce complexity of nested jq arguments while maintaining identical output format
This commit is contained in:
19
.github/workflows/release-notify-wechat.yml
vendored
19
.github/workflows/release-notify-wechat.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Release Notify (Ali AI Final)
|
name: Release Notify Workflow
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -89,18 +89,11 @@ jobs:
|
|||||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||||
AI_SUMMARY: ${{ steps.ai.outputs.summary }}
|
AI_SUMMARY: ${{ steps.ai.outputs.summary }}
|
||||||
run: |
|
run: |
|
||||||
jq -n \
|
CONTENT=$(printf '## 🚀 Release 发布通知\n> 📦 **分支**: %s\n> 👤 **提交人**: %s\n> 📝 **标题**: %s\n\n### 🧠 AI变更摘要\n%s\n\n---\n🔗 [查看PR详情](%s)' \
|
||||||
--arg branch "$BRANCH" \
|
"$BRANCH" "$AUTHOR" "$PR_TITLE" "$AI_SUMMARY" "$PR_URL")
|
||||||
--arg author "$AUTHOR" \
|
|
||||||
--arg title "$PR_TITLE" \
|
jq -n --arg content "$CONTENT" \
|
||||||
--arg url "$PR_URL" \
|
'{"msgtype": "markdown", "markdown": {"content": $content}}' > wechat_payload.json
|
||||||
--arg summary "$AI_SUMMARY" \
|
|
||||||
'{
|
|
||||||
msgtype: "markdown",
|
|
||||||
markdown: {
|
|
||||||
content: "## 🚀 Release 发布通知\n> 📦 **分支**: \($branch)\n> 👤 **提交人**: \($author)\n> 📝 **标题**: \($title)\n\n### 🧠 AI变更摘要\n\($summary)\n\n---\n🔗 [查看PR详情](\($url))"
|
|
||||||
}
|
|
||||||
}' > wechat_payload.json
|
|
||||||
|
|
||||||
curl -s "$WECHAT_WEBHOOK" \
|
curl -s "$WECHAT_WEBHOOK" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
|
|||||||
Reference in New Issue
Block a user