new_notify #40

Merged
alex merged 3 commits from new_notify into main 2025-10-15 13:09:46 +00:00

View File

@@ -36,36 +36,31 @@ runs:
*) echo "ICON=" >> $GITHUB_ENV ;;
esac
- name: Notify VK Teams
uses: dosymep/vk-teams-action@v1.0.0
- name: Notify VK Teams (native)
if: always()
shell: bash
continue-on-error: true
with:
token: ${{ env.token }}
to: ${{ env.to }}
format: MarkdownV2
message: |
*${{ github.repository }}* \- \[${{ inputs.name }}\]\(${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}\) \
was *${{ inputs.result }}* by ${{ github.event.sender.login }} ${{ env.ICON }}
- name: Wait a bit (ensure send completes)
if: always()
shell: bash
run: |
echo "[DEBUG] Starting sleep to ensure message delivery..."
date
sleep 5
echo "[DEBUG] Finished sleep, message should have been delivered."
date
echo "[DEBUG] Sending VK Teams notification..."
JSON_PAYLOAD=$(jq -n \
--arg token "${{ env.token }}" \
--arg to "${{ env.to }}" \
--arg fmt "MarkdownV2" \
--arg msg "*${{ github.repository }}* - [${{ inputs.name }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}) was *${{ inputs.result }}* by ${{ github.event.sender.login }} ${{ env.ICON }}" \
'{token: $token, chatId: $to, parseMode: $fmt, text: $msg}')
- name: Force wait for container cleanup
if: always()
shell: bash
run: |
echo "[DEBUG] Waiting for runner cleanup barrier..."
# пока Docker демон удаляет контейнер, удерживаем процесс активным
for i in {1..5}; do
docker ps -a | grep act || break
echo "[DEBUG] Runner still cleaning up... $i"
sleep 1
done
echo "[DEBUG] Cleanup done."
# Отправка запроса
curl -s -X POST "https://myteam.mail.ru/bot/v1/messages/sendText" \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD"
CODE=$?
if [ $CODE -ne 0 ]; then
echo "[WARN] VK Teams notification failed with exit code $CODE"
else
echo "[INFO] VK Teams notification sent successfully"
fi
# Делаем паузу, чтобы убедиться, что сообщение дошло
echo "[DEBUG] Sleeping 5s to ensure delivery..."
sleep 5