Skip to content

Commit c8f8ca3

Browse files
authored
chore: add Author for send message (#679)
1 parent 20287c9 commit c8f8ca3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.github/utils/webhook_utils.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ send_message() {
174174
if [[ "$CONTENT_TMP" == *"success"* ]]; then
175175
curl -H "Content-Type: application/json" -X POST $BOT_WEBHOOK \
176176
-d '{"msg_type":"post","content":{"post":{"zh_cn":{"title":"Success:","content":[[{"tag":"text","text":"'$CONTENT'"}]]}}}}'
177+
elif [[ -n "${PR_AUTHOR}" ]]; then
178+
curl -H "Content-Type: application/json" -X POST $BOT_WEBHOOK \
179+
-d '{"msg_type":"post","content":{"post":{"zh_cn":{"title":"Error:","content":[[{"tag":"text","text":" Author:'${PR_AUTHOR}' "},{"tag":"a","text":"'$CONTENT'","href":"'$RUN_URL'"}]]}}}}'
177180
else
178181
curl -H "Content-Type: application/json" -X POST $BOT_WEBHOOK \
179182
-d '{"msg_type":"post","content":{"post":{"zh_cn":{"title":"Error:","content":[[{"tag":"a","text":"'$CONTENT'","href":"'$RUN_URL'"}]]}}}}'

.github/workflows/feishui-message.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,17 @@ jobs:
111111
if [[ -n "${{ inputs.PR_NUMBER }}" ]]; then
112112
cmd="${cmd} --pr-number '${{ inputs.PR_NUMBER }}' "
113113
fi
114+
114115
if [[ "${{ inputs.TYPE }}" == "5" ]]; then
115116
if [[ -n "${{ inputs.PR_AUTHOR }}" ]]; then
116117
cmd="${cmd} --pr-author '${{ inputs.PR_AUTHOR }}' "
117118
else
118119
cmd="${cmd} --pr-author '${{ github.event.issue.user.login }}' "
119120
fi
121+
else
122+
if [[ -n "${{ inputs.PR_AUTHOR }}" ]]; then
123+
cmd="${cmd} --pr-author '${{ inputs.PR_AUTHOR }}' "
124+
fi
120125
fi
121126
122127
echo "$cmd"

0 commit comments

Comments
 (0)