fix status

This commit is contained in:
Kirill Chikalin
2025-03-20 10:18:48 +03:00
parent 0c86f5d6e9
commit eccc9fcc11

View File

@@ -5,6 +5,10 @@ inputs:
description: "Text"
required: false
default: ''
caption:
description: "Text"
required: false
default: "<a href='${{ github.event.repository.html_url }}/actions/runs/${{ github.run_number }}'>%23${{ github.run_number }}</a> <b>${{ github.event.repository.name }}</b><br>"
message_id:
description: "Message ID"
required: false
@@ -20,7 +24,7 @@ inputs:
status:
description: "Status message"
required: false
default: 'true'
default: ${{ job.status }}
chat_id:
description: "Chat ID"
required: true
@@ -52,24 +56,20 @@ runs:
GITHUB_ACTION_PATH: ${{ github.action_path }}
- name: Send message
# if: inputs.message != '' && status == ''
run: |
if [[ "${{ inputs.status }}" == "true" ]]; then
if [[ "${{ job.status }}" == "success" ]]; then
STATUS = ${{ inputs.status }}
if [[ STATUS == "success" ]]; then
STATUS="✅"
elif [[ "${{ job.status }}" == "failure" ]]; then
elif [[ STATUS == "failure" ]]; then
STATUS="❌"
elif [[ "${{ job.status }}" == "cancelled" ]]; then
elif [[ STATUS == "cancelled" ]]; then
STATUS="⚠️"
else
STATUS="🚀"
fi
caption="<a href='${{ github.event.repository.html_url }}/actions/runs/${{ github.run_number }}'>%23${{ github.run_number }}</a> <b>${{ github.event.repository.name }}</b>"
STATUS="$STATUS caption\n"
else
STATUS=""
if [[ STATUS != '' ]]; then
STATUS="$STATUS "
fi
sendMessage "${{ inputs.bot_token }}" ${{ inputs.chat_id }} "$STATUS${{ inputs.message }}"
CAPTION="$STATUS${{ inputs.caption }}"
sendMessage "${{ inputs.bot_token }}" ${{ inputs.chat_id }} "$CAPTION${{ inputs.message }}"
shell: bash
- name: Delete message