From 565a93dbf4fa2ccbc1fd7a1bb44e68ff1f403bd2 Mon Sep 17 00:00:00 2001 From: Dluter Date: Fri, 22 Sep 2023 07:21:57 +0800 Subject: [PATCH] fix: ci notify --- .github/workflows/main.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2b384e6..c70f935 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,14 +25,24 @@ jobs: echo "content=[{\"title\": \"Main Has New Commit\", \"url\": \"https://github.com/${{ github.repository }}\", \"description\": \"## Main updated Please pull the latest commit\",\"fields\": [{\"name\": \"Commit Message\", \"value\": $ESCAPED_COMMIT_MESSAGE }, {\"name\": \"Owner\", \"value\": \"${{ github.event.head_commit.author.username }}\"}, {\"name\": \"Trigger Actor\", \"value\": \"${{ github.triggering_actor }}\"}, {\"name\": \"Status\", \"value\": \"${{ needs.check.result == 'failure' && 'Failure' || 'Success' }}\"}], \"footer\": {\"text\": \"created at ${{ github.event.head_commit.timestamp }}\"}}]" >> $GITHUB_OUTPUT + - name: No Message CONTENT + id: no_message_CONTENT + if: always() + run: | + COMMIT_MESSAGE="${{ github.event.head_commit.message }}" + ESCAPED_COMMIT_MESSAGE=$(echo "$COMMIT_MESSAGE" | jq -s -R -r @json) + + echo "content=[{\"title\": \"Main Has New Commit\", \"url\": \"https://github.com/${{ github.repository }}\", \"description\": \"## Main updated Please pull the latest commit\",\"fields\": [{\"name\": \"Commit Message\", \"value\": \" the message not display \" }, {\"name\": \"Owner\", \"value\": \"${{ github.event.head_commit.author.username }}\"}, {\"name\": \"Trigger Actor\", \"value\": \"${{ github.triggering_actor }}\"}, {\"name\": \"Status\", \"value\": \"${{ needs.check.result == 'failure' && 'Failure' || 'Success' }}\"}], \"footer\": {\"text\": \"created at ${{ github.event.head_commit.timestamp }}\"}}]" >> $GITHUB_OUTPUT + - run: | echo ${{ steps.CONTENT.outputs.content }} - name: Can Review PR + if: always() env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} DISCORD_USERNAME: GitHub Actions DISCORD_AVATAR: https://avatars.githubusercontent.com/u/44036562?s=200&v=4 - DISCORD_EMBEDS: ${{ steps.CONTENT.outputs.content }} + DISCORD_EMBEDS: ${{ steps.CONTENT.outputs.content || steps.CONTENT.outputs.content }} uses: Ilshidur/action-discord@master with: args: ""