From 5ff69f7e603e00d9e0a84ee81cadd74b0b8e2b82 Mon Sep 17 00:00:00 2001 From: HChenX Date: Thu, 9 Nov 2023 20:54:21 +0800 Subject: [PATCH] test github workflows Signed-off-by: HChenX --- .github/workflows/android.yml | 10 ++++++++-- .github/workflows/androidr.yml | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 32dc3c15cb..1871b59228 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -74,11 +74,17 @@ jobs: CHANNEL_ID: ${{ secrets.CHANNEL_ID }} BOT_TOKEN: ${{ secrets.BOT_TOKEN }} CANARY: ${{ env.APK_FILE_CANARY }} + COMMIT_MESSAGE: |+ + Github Action for Main + + ${{ github.event.head_commit.message }} + by ${{ github.event.head_commit.author.name }} + See more [here](${{ github.event.head_commit.url }}) + COMMIT_URL: ${{ github.event.head_commit.url }} run: | mkdir -p ${{ github.workspace }}/git_clone git clone ${{ github.event.repository.url }} ${{ github.workspace }}/git_clone -b ${{ github.ref_name }} cd ${{ github.workspace }}/git_clone - { echo -e 'Github Action for Main\n'; git log ${{ github.event.before }}..${{ github.event.after }} --pretty=format:"%h %s"; echo -e " (by ${{ github.event.head_commit.author.name }})"; } > ${{ github.workspace }}/git_log - ESCAPED="$(cat ${{ github.workspace }}/git_log | gawk '{gsub(/[_*[\]()~`>#+=\|{}.!-]/,"\\\\\\\\&")}1' | sed -e 's|"|\\"|g' -e 's|^[0-9a-z]\+|__&__|' | hexdump -v -e '/1 "%02X"' | sed 's/\(..\)/%\1/g')" + ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'` cd ${{ github.workspace }} curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fcanary%22%2C%22parse_mode%22%3A%22Markdown%22%2C%22caption%22%3A%22${ESCAPED}%22%7D%5D" -F canary="@${CANARY}" diff --git a/.github/workflows/androidr.yml b/.github/workflows/androidr.yml index f9e63e77c0..eb2cbe95e1 100644 --- a/.github/workflows/androidr.yml +++ b/.github/workflows/androidr.yml @@ -75,11 +75,17 @@ jobs: CHANNEL_ID: ${{ secrets.CHANNEL_ID }} BOT_TOKEN: ${{ secrets.BOT_TOKEN_TWO }} CANARY: ${{ env.APK_FILE_CANARY }} + COMMIT_MESSAGE: |+ + Github Action for Android_R + + ${{ github.event.head_commit.message }} + by ${{ github.event.head_commit.author.name }} + See more [here](${{ github.event.head_commit.url }}) + COMMIT_URL: ${{ github.event.head_commit.url }} run: | mkdir -p ${{ github.workspace }}/git_clone git clone ${{ github.event.repository.url }} ${{ github.workspace }}/git_clone -b ${{ github.ref_name }} cd ${{ github.workspace }}/git_clone - { echo -e 'Github Action for Android_R\n'; git log ${{ github.event.before }}..${{ github.event.after }} --pretty=format:"%h %s"; echo -e "\nby ${{ github.event.head_commit.author.name }}"; } > ${{ github.workspace }}/git_log - ESCAPED="$(cat ${{ github.workspace }}/git_log | gawk '{gsub(/[_*[\]()~`>#+=\|{}.!-]/,"\\\\\\\\&")}1' | sed -e 's|"|\\"|g' -e 's|^[0-9a-z]\+|__&__|' | hexdump -v -e '/1 "%02X"' | sed 's/\(..\)/%\1/g')" + ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'` cd ${{ github.workspace }} curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fcanary%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22%3A%22${ESCAPED}%22%7D%5D" -F canary="@${CANARY}"