ci(workflow): add PR number and merge commit SHA to WeChat release notification

- Add PR_NUMBER environment variable to capture pull request number
- Add MERGE_SHA environment variable to capture merge commit SHA
- Extract short SHA (first 7 characters) from merge commit for display
- Update notification content to include PR number with # prefix
- Update notification content to include short commit SHA
- Improve release notification with additional metadata for better traceability
This commit is contained in:
Ke Sun
2026-04-16 17:43:23 +08:00
parent 5ce0bdb0f5
commit 62edafcebe

View File

@@ -121,6 +121,8 @@ jobs:
AUTHOR: ${{ github.event.pull_request.user.login }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_NUMBER: ${{ github.event.pull_request.number }}
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
SOURCERY_FOUND: ${{ steps.sourcery.outputs.found }}
SOURCERY_SUMMARY: ${{ steps.sourcery.outputs.summary }}
QWEN_SUMMARY: ${{ steps.qwen.outputs.summary }}
@@ -135,11 +137,16 @@ jobs:
label = "AI变更摘要"
summary = os.environ.get("QWEN_SUMMARY", "AI 摘要生成失败")
pr_number = os.environ.get("PR_NUMBER", "")
short_sha = os.environ.get("MERGE_SHA", "")[:7]
content = (
"## 🚀 Release 发布通知\n"
"> 📦 **分支**: " + os.environ["BRANCH"] + "\n"
"> <EFBFBD> **分支**: " + os.environ["BRANCH"] + "\n"
"> 👤 **提交人**: " + os.environ["AUTHOR"] + "\n"
"> 📝 **标题**: " + os.environ["PR_TITLE"] + "\n\n"
"> 📝 **标题**: " + os.environ["PR_TITLE"] + "\n"
"> 🔢 **PR编号**: #" + pr_number + "\n"
"> 🔖 **Commit**: " + short_sha + "\n\n"
"### 🧠 " + label + "\n" +
summary + "\n\n"
"---\n"