From c85f6989335ac500f923b5184752f1884adbb7aa Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:19:50 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Notify.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/Notify.yml diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml new file mode 100644 index 0000000..a5e2a73 --- /dev/null +++ b/.github/workflows/Notify.yml @@ -0,0 +1,32 @@ +name: Notify + +on: + push: + branches: + - main + +jobs: + notify: + runs-on: ubuntu-latest + + steps: + - name: Send notification + uses: actions/http-client@v1 + with: + url: 'https://${{ secrets.APIURL }}/send_group_msg' + method: 'POST' + headers: | + Authorization: Bearer ${{ secrets.APITOKEN }} + Content-Type: application/json + body: | + { + "group_id": "1053570434", + "message": [ + { + "type": "text", + "data": { + "text": "主分支已更新!最新提交: ${{ github.sha }}" + } + } + ] + } From c2c5ff0595e040c48bfe80cac5b283cc264b71f3 Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:21:46 +0800 Subject: [PATCH 02/13] Update Notify.yml --- .github/workflows/Notify.yml | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index a5e2a73..42b32b3 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -11,22 +11,19 @@ jobs: steps: - name: Send notification - uses: actions/http-client@v1 - with: - url: 'https://${{ secrets.APIURL }}/send_group_msg' - method: 'POST' - headers: | - Authorization: Bearer ${{ secrets.APITOKEN }} - Content-Type: application/json - body: | - { - "group_id": "1053570434", - "message": [ - { - "type": "text", - "data": { - "text": "主分支已更新!最新提交: ${{ github.sha }}" - } - } - ] - } + run: | + curl -X POST \ + "https://${{ secrets.APIURL }}/send_group_msg" \ + -H "Authorization: Bearer ${{ secrets.APITOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{ + "group_id": "1053570434", + "message": [ + { + "type": "text", + "data": { + "text": "主分支已更新!最新提交: ${{ github.sha }}" + } + } + ] + }' From 79822ecc66fb0d4476418ce374b44fe5a324b3a9 Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:29:28 +0800 Subject: [PATCH 03/13] Update Notify.yml --- .github/workflows/Notify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index 42b32b3..51d4aac 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -22,7 +22,7 @@ jobs: { "type": "text", "data": { - "text": "主分支已更新!最新提交: ${{ github.sha }}" + "text": "主分支已更新!\n最新提交: ${{ github.sha }}\n提交者:${GITHUB_ACTOR}\n描述:${{ github.event.head_commit.message }}" } } ] From dff03f70f5d1d5b83066ab887ffe6a6158984dd7 Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:31:14 +0800 Subject: [PATCH 04/13] Update Notify.yml --- .github/workflows/Notify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index 51d4aac..2bd3028 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -22,7 +22,7 @@ jobs: { "type": "text", "data": { - "text": "主分支已更新!\n最新提交: ${{ github.sha }}\n提交者:${GITHUB_ACTOR}\n描述:${{ github.event.head_commit.message }}" + "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述: ${{ github.event.head_commit.message }}\n🔗 提交: ${{ github.sha }}" } } ] From c1fe14ccab0186cf01c6f16995060800f250f8ff Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:32:03 +0800 Subject: [PATCH 05/13] Update Notify.yml --- .github/workflows/Notify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index 2bd3028..86a5be2 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -22,7 +22,7 @@ jobs: { "type": "text", "data": { - "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述: ${{ github.event.head_commit.message }}\n🔗 提交: ${{ github.sha }}" + "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述:\n🔗 提交: ${{ github.sha }}" } } ] From 278fbbcfa726aa040aa1d9a6bcd2bdfd81650093 Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:37:03 +0800 Subject: [PATCH 06/13] Update Notify.yml --- .github/workflows/Notify.yml | 39 ++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index 86a5be2..d92229d 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -10,20 +10,37 @@ jobs: runs-on: ubuntu-latest steps: + - name: Install jq + run: sudo apt-get install -y jq + + - name: Extract commit info + id: commit-info + run: | + AUTHOR_NAME="${{ github.event.head_commit.author.name }}" + COMMIT_MESSAGE=$(echo '${{ github.event.head_commit.message }}' | jq -R . | sed 's/^"//;s/"$//') + echo "author_name=$AUTHOR_NAME" >> $GITHUB_OUTPUT + echo "commit_message=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT + - name: Send notification run: | + JSON_DATA=$(jq -n \ + --arg sha "${{ github.sha }}" \ + --arg author "${{ steps.commit-info.outputs.author_name }}" \ + --arg message "${{ steps.commit-info.outputs.commit_message }}" \ + '{ + "group_id": "1053570434", + "message": [ + { + "type": "text", + "data": { + "text": "📢 主分支已更新!\n\n👤 作者: \($author)\n📝 描述: \($message)\n🔗 提交: \($sha)" + } + } + ] + }') + curl -X POST \ "https://${{ secrets.APIURL }}/send_group_msg" \ -H "Authorization: Bearer ${{ secrets.APITOKEN }}" \ -H "Content-Type: application/json" \ - -d '{ - "group_id": "1053570434", - "message": [ - { - "type": "text", - "data": { - "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述:\n🔗 提交: ${{ github.sha }}" - } - } - ] - }' + -d "$JSON_DATA" From c47b247b849f8438f06ec02bd217d0b8c753c9f9 Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:41:14 +0800 Subject: [PATCH 07/13] Update Notify.yml --- .github/workflows/Notify.yml | 41 ++++++++++++------------------------ 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index d92229d..f4ea7e9 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -10,37 +10,24 @@ jobs: runs-on: ubuntu-latest steps: - - name: Install jq - run: sudo apt-get install -y jq - - - name: Extract commit info - id: commit-info - run: | - AUTHOR_NAME="${{ github.event.head_commit.author.name }}" - COMMIT_MESSAGE=$(echo '${{ github.event.head_commit.message }}' | jq -R . | sed 's/^"//;s/"$//') - echo "author_name=$AUTHOR_NAME" >> $GITHUB_OUTPUT - echo "commit_message=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT - - name: Send notification run: | - JSON_DATA=$(jq -n \ - --arg sha "${{ github.sha }}" \ - --arg author "${{ steps.commit-info.outputs.author_name }}" \ - --arg message "${{ steps.commit-info.outputs.commit_message }}" \ - '{ - "group_id": "1053570434", - "message": [ - { - "type": "text", - "data": { - "text": "📢 主分支已更新!\n\n👤 作者: \($author)\n📝 描述: \($message)\n🔗 提交: \($sha)" - } - } - ] - }') + # 基本转义处理 + MESSAGE=$(echo '${{ github.event.head_commit.message }}' | sed 's/"/\\"/g') + AUTHOR="${{ github.event.head_commit.author.name || github.actor }}" curl -X POST \ "https://${{ secrets.APIURL }}/send_group_msg" \ -H "Authorization: Bearer ${{ secrets.APITOKEN }}" \ -H "Content-Type: application/json" \ - -d "$JSON_DATA" + -d "{ + \"group_id\": \"1053570434\", + \"message\": [ + { + \"type\": \"text\", + \"data\": { + \"text\": \"📢 主分支已更新!\n\n👤 作者: $AUTHOR\n📝 描述: $MESSAGE\n🔗 提交: ${{ github.sha }}\" + } + } + ] + }" From dcc11db8ae2bfde5f980eb23e0c7699db7695512 Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:47:09 +0800 Subject: [PATCH 08/13] Update Notify.yml --- .github/workflows/Notify.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index f4ea7e9..2eb4dec 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -12,22 +12,18 @@ jobs: steps: - name: Send notification run: | - # 基本转义处理 - MESSAGE=$(echo '${{ github.event.head_commit.message }}' | sed 's/"/\\"/g') - AUTHOR="${{ github.event.head_commit.author.name || github.actor }}" - curl -X POST \ "https://${{ secrets.APIURL }}/send_group_msg" \ -H "Authorization: Bearer ${{ secrets.APITOKEN }}" \ -H "Content-Type: application/json" \ - -d "{ - \"group_id\": \"1053570434\", - \"message\": [ - { - \"type\": \"text\", - \"data\": { - \"text\": \"📢 主分支已更新!\n\n👤 作者: $AUTHOR\n📝 描述: $MESSAGE\n🔗 提交: ${{ github.sha }}\" - } - } - ] - }" + -d '{ + "group_id": "1053570434", + "message": [ + { + "type": "text", + "data": { + "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述: ${{ GITHUB_EVENT_NAME }}\n🔗 提交: ${{ github.sha }}" + } + } + ] + }' From 1c48d411977c5436868f202048a4d1b421b903c1 Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:48:42 +0800 Subject: [PATCH 09/13] Update Notify.yml --- .github/workflows/Notify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index 2eb4dec..f217604 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -22,7 +22,7 @@ jobs: { "type": "text", "data": { - "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述: ${{ GITHUB_EVENT_NAME }}\n🔗 提交: ${{ github.sha }}" + "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述: ${{ GITHUB.EVENT.NAME }}\n🔗 提交: ${{ github.sha }}" } } ] From 04a7e53a90a8c8691e5a5192467d2b7dfc244374 Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:55:33 +0800 Subject: [PATCH 10/13] Update Notify.yml --- .github/workflows/Notify.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index f217604..ed7b1de 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -8,10 +8,11 @@ on: jobs: notify: runs-on: ubuntu-latest - steps: - name: Send notification run: | + COMMIT_MESSAGE=$(echo '${{ github.event.head_commit.message }}' | tr '\n' ' ') + curl -X POST \ "https://${{ secrets.APIURL }}/send_group_msg" \ -H "Authorization: Bearer ${{ secrets.APITOKEN }}" \ @@ -22,7 +23,7 @@ jobs: { "type": "text", "data": { - "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述: ${{ GITHUB.EVENT.NAME }}\n🔗 提交: ${{ github.sha }}" + "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述: '"$COMMIT_MESSAGE"'\n🔗 提交: ${{ github.sha }}" } } ] From fb7f929bd7bbf0245544efbb8de5773ad93433ee Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 16:54:02 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E9=85=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Notify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index ed7b1de..82688d2 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -18,7 +18,7 @@ jobs: -H "Authorization: Bearer ${{ secrets.APITOKEN }}" \ -H "Content-Type: application/json" \ -d '{ - "group_id": "1053570434", + "group_id": "1049806011", "message": [ { "type": "text", From 144c97ec6886fd1c20a5ffd75eed5baa7c26af63 Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 20:33:02 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=80=A7=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/Notify.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index 82688d2..9097f2b 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -10,8 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Send notification + env: + COMMIT_MESSAGE: ${{ github.event.head_commit.message }} run: | - COMMIT_MESSAGE=$(echo '${{ github.event.head_commit.message }}' | tr '\n' ' ') + SANITIZED_COMMIT_MESSAGE=$(echo "$COMMIT_MESSAGE" | tr '\n' ' ') curl -X POST \ "https://${{ secrets.APIURL }}/send_group_msg" \ @@ -23,7 +25,7 @@ jobs: { "type": "text", "data": { - "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述: '"$COMMIT_MESSAGE"'\n🔗 提交: ${{ github.sha }}" + "text": "📢 主分支已更新!\n\n👤 作者: ${{ github.actor }}\n📝 描述: '"$SANITIZED_COMMIT_MESSAGE"'\n🔗 提交: ${{ github.sha }}" } } ] From cf9aedbac79af6ab22b0b959f5a683600cf36d93 Mon Sep 17 00:00:00 2001 From: Redstonexs <154490540+Redstonexs@users.noreply.github.com> Date: Thu, 19 Jun 2025 23:02:39 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=80=A7=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Notify.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/Notify.yml b/.github/workflows/Notify.yml index 9097f2b..28adb5d 100644 --- a/.github/workflows/Notify.yml +++ b/.github/workflows/Notify.yml @@ -1,5 +1,8 @@ name: Notify +permissions: + contents: read + on: push: branches: