Merge pull request #881 from SuanmoSuanyangTechnology/fix/simple-fix
ci(wechat-notify): replace curl with urllib for webhook request
This commit is contained in:
16
.github/workflows/release-notify-wechat.yml
vendored
16
.github/workflows/release-notify-wechat.yml
vendored
@@ -78,7 +78,7 @@ jobs:
|
|||||||
AI_SUMMARY: ${{ steps.ai.outputs.summary }}
|
AI_SUMMARY: ${{ steps.ai.outputs.summary }}
|
||||||
run: |
|
run: |
|
||||||
python3 << 'PYEOF'
|
python3 << 'PYEOF'
|
||||||
import json, os
|
import json, os, urllib.request
|
||||||
content = (
|
content = (
|
||||||
"## 🚀 Release 发布通知\n"
|
"## 🚀 Release 发布通知\n"
|
||||||
"> 📦 **分支**: " + os.environ["BRANCH"] + "\n"
|
"> 📦 **分支**: " + os.environ["BRANCH"] + "\n"
|
||||||
@@ -90,10 +90,12 @@ jobs:
|
|||||||
"🔗 [查看PR详情](" + os.environ["PR_URL"] + ")"
|
"🔗 [查看PR详情](" + os.environ["PR_URL"] + ")"
|
||||||
)
|
)
|
||||||
payload = {"msgtype": "markdown", "markdown": {"content": content}}
|
payload = {"msgtype": "markdown", "markdown": {"content": content}}
|
||||||
with open("wechat.json", "w", encoding="utf-8") as f:
|
data = json.dumps(payload, ensure_ascii=False).encode("utf-8")
|
||||||
json.dump(payload, f, ensure_ascii=False)
|
req = urllib.request.Request(
|
||||||
|
os.environ["WECHAT_WEBHOOK"],
|
||||||
|
data=data,
|
||||||
|
headers={"Content-Type": "application/json"}
|
||||||
|
)
|
||||||
|
resp = urllib.request.urlopen(req)
|
||||||
|
print(resp.read().decode())
|
||||||
PYEOF
|
PYEOF
|
||||||
|
|
||||||
curl -s "$WECHAT_WEBHOOK" \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d @wechat.json
|
|
||||||
|
|||||||
Reference in New Issue
Block a user