JSON格式化不支持value本身包含双引号 #244
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Issue and Discussions Trigger | |
on: | |
issues: | |
types: [opened] | |
discussion: | |
types: [created] | |
jobs: | |
send_message: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send message | |
run: | | |
generate_post_data(){ | |
text="有新的 Discussion: https://github.com/he3-app/he3-feedback/issues/new?created_from_discussion_number=${{ github.event.discussion.number }}" | |
if [ ${{ github.event_name }} == "issues" ]; then | |
text="有新的 Issue: https://github.com/he3-app/he3-feedback/issues/${{ github.event.issue.number }}" | |
fi | |
cat <<EOF | |
{ | |
"msg_type": "text", | |
"content": { | |
"text": "$text" | |
} | |
} | |
EOF | |
} | |
curl -X POST -H "Content-Type: application/json" \ | |
-d "$(generate_post_data)" \ | |
https://open.feishu.cn/open-apis/bot/v2/hook/${{ secrets.FEISHU_BOT_WEBHOOK_URL }} |