Skip to content

Commit

Permalink
ci(notify): disable escape characters in echo
Browse files Browse the repository at this point in the history
  • Loading branch information
akinoccc committed Nov 12, 2024
1 parent b55dbbf commit 7e4af3e
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ jobs:
if [ "${{ github.event.workflow_run.event }}" == "push" ]; then
echo "EVENT_TYPE=push" >> $GITHUB_ENV
echo "Author=${{ github.event.workflow_run.actor.login }}" >> $GITHUB_ENV
echo "MESSAGE=${{ github.event.workflow_run.head_commit.message }}" >> $GITHUB_ENV
echo "MESSAGE=${{ github.event.workflow_run.head_commit.message }}"
elif [ "${{ github.event.workflow_run.event }}" == "pull_request" ]; then
echo "EVENT_TYPE=pull_request" >> $GITHUB_ENV
echo "Author=${{ github.event.workflow_run.event.pull_request.user.login }}" >> $GITHUB_ENV
echo "MESSAGE=${{ github.event.workflow_run.event.pull_request.title }}" >> $GITHUB_ENV
echo "MESSAGE=${{ github.event.workflow_run.event.pull_request.title }}"
fi
echo "$MESSAGE"
ESCAPED_MESSAGE=$(echo "$MESSAGE" | sed 's/"/\"/g')
echo "$ESCAPED_MESSAGE"
echo "MESSAGE=$ESCAPED_MESSAGE" >> $GITHUB_ENV
echo "WORKFLOW_NAME=${{ github.event.workflow_run.name }}" >> $GITHUB_ENV
- name: Set Notification Title
Expand All @@ -40,17 +46,19 @@ jobs:
echo "TITLE=❌ ${{ env.WORKFLOW_NAME }} Failed" >> $GITHUB_ENV
fi
- name: Send WeCom Bot Notification
uses: amazing-actions/wecom-bot-notify@main
with:
type: markdown
key: ${{ secrets.WECOM_COSY_BOT_KEY }}
content: |
**${{ env.TITLE }}**
> Repository: **${{ github.repository }}**
> Event: ${{ env.EVENT_TYPE }}
> Branch: ${{ github.event.workflow_run.head_branch }}
> Author: ${{ env.Author }}
> Message: ${{ env.MESSAGE }}
> Detail: [查看详情](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }})
echo "${{env.MESSAGE}}"
# - name: Send WeCom Bot Notification
# uses: amazing-actions/wecom-bot-notify@main
# with:
# type: markdown
# key: ${{ secrets.WECOM_COSY_BOT_KEY }}
# content: |
# **${{ env.TITLE }}**
#
# > Repository: **${{ github.repository }}**
# > Event: ${{ env.EVENT_TYPE }}
# > Branch: ${{ github.event.workflow_run.head_branch }}
# > Author: ${{ env.Author }}
# > Message: ${{ env.MESSAGE }}
# > Detail: [查看详情](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }})

0 comments on commit 7e4af3e

Please sign in to comment.