Skip to content

Commit

Permalink
ci: 优化tg上传信息
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow3aaa committed Oct 22, 2024
1 parent 06c80b9 commit 3987ed5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,12 @@ jobs:
BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
THREAD_ID: ${{ secrets.THREAD_ID }}
COMMIT_MESSAGE: |+
New push to GitHub
by `${{ github.triggering_actor }}`
New push to GitHub\n
by `${{ github.triggering_actor }}`\n
${{ github.event.head_commit.message }}
run: |
export COMMIT_MESSAGE_FIXED=$(echo $COMMIT_MESSAGE | awk '{gsub(/\\/, "\\\\"); gsub(/\*/, "\\*"); gsub(/_/, "\\_"); gsub(/`/, "\\`"); gsub(/\[/, "\\["); gsub(/\]/, "\\]"); gsub(/\(/, "\\("); gsub(/\)/, "\\)"); gsub(/~/, "\\~"); gsub(/>/, "\\>"); gsub(/#/, "\\#"); gsub(/\+/, "\\+"); gsub(/-/, "\\-"); gsub(/=/, "\\="); gsub(/\./, "\\."); gsub(/!/, "\\!"); print}')
ESCAPED=$(python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE_FIXED"])))')
cd ${{ github.workspace }}
echo $COMMIT_MESSAGE_FIXED
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${GROUP_DEBUG_ID}&message_thread_id=${THREAD_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://debug_zip%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:${ESCAPED}%7D,%7B%22type%22:%22document%22,%20%22media%22:%22attach://release_zip%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:${ESCAPED}%7D%5D" -F debug_zip="@artifacts/fas-rs(debug).zip" -F release_zip="@artifacts/fas-rs(release).zip"
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${GROUP_DEBUG_ID}&message_thread_id=${THREAD_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://debug_zip%22,%22parse_mode%22:%22MarkdownV2%22,%7B%22type%22:%22document%22,%20%22media%22:%22attach://release_zip%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:${ESCAPED}%7D%5D" -F debug_zip="@artifacts/fas-rs(debug).zip" -F release_zip="@artifacts/fas-rs(release).zip"

0 comments on commit 3987ed5

Please sign in to comment.