Skip to content

Commit 2ad27e9

Browse files
committed
添加飞书部署通知
1 parent 6b656f6 commit 2ad27e9

File tree

1 file changed

+77
-7
lines changed

1 file changed

+77
-7
lines changed

.github/workflows/deploy.yml

Lines changed: 77 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,81 @@ jobs:
122122
echo "❌ 部署失败!"
123123
fi
124124
125-
# 可选:发送通知到 Slack/Discord/钉钉等
126-
# - name: Send notification
127-
# if: always()
128-
# uses: 8398a7/action-slack@v3
129-
# with:
130-
# status: ${{ job.status }}
131-
# webhook_url: ${{ secrets.SLACK_WEBHOOK }}
125+
# 飞书通知
126+
- name: Send Feishu notification
127+
if: always()
128+
run: |
129+
if [ "${{ job.status }}" == "success" ]; then
130+
STATUS_COLOR="green"
131+
STATUS_TEXT="✅ 部署成功"
132+
STATUS_EMOJI="✅"
133+
else
134+
STATUS_COLOR="red"
135+
STATUS_TEXT="❌ 部署失败"
136+
STATUS_EMOJI="❌"
137+
fi
138+
139+
curl -X POST "${{ secrets.FEISHU_WEBHOOK_URL }}" \
140+
-H "Content-Type: application/json" \
141+
-d "{
142+
\"msg_type\": \"interactive\",
143+
\"card\": {
144+
\"header\": {
145+
\"title\": {
146+
\"content\": \"$STATUS_EMOJI DeepMed Search 部署通知\",
147+
\"tag\": \"plain_text\"
148+
},
149+
\"template\": \"$STATUS_COLOR\"
150+
},
151+
\"elements\": [
152+
{
153+
\"tag\": \"div\",
154+
\"fields\": [
155+
{
156+
\"is_short\": true,
157+
\"text\": {
158+
\"tag\": \"lark_md\",
159+
\"content\": \"**状态**\\n$STATUS_TEXT\"
160+
}
161+
},
162+
{
163+
\"is_short\": true,
164+
\"text\": {
165+
\"tag\": \"lark_md\",
166+
\"content\": \"**分支**\\n\`${{ github.ref_name }}\`\"
167+
}
168+
},
169+
{
170+
\"is_short\": true,
171+
\"text\": {
172+
\"tag\": \"lark_md\",
173+
\"content\": \"**提交者**\\n${{ github.actor }}\"
174+
}
175+
},
176+
{
177+
\"is_short\": true,
178+
\"text\": {
179+
\"tag\": \"lark_md\",
180+
\"content\": \"**提交信息**\\n${{ github.event.head_commit.message }}\"
181+
}
182+
}
183+
]
184+
},
185+
{
186+
\"tag\": \"action\",
187+
\"actions\": [
188+
{
189+
\"tag\": \"button\",
190+
\"text\": {
191+
\"tag\": \"plain_text\",
192+
\"content\": \"查看详情\"
193+
},
194+
\"type\": \"primary\",
195+
\"url\": \"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"
196+
}
197+
]
198+
}
199+
]
200+
}
201+
}"
132202

0 commit comments

Comments
 (0)