Files
workflows/.gitea/actions/vk-notify/action.yaml
2025-10-15 15:25:44 +03:00

70 lines
2.2 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: 'notify'
description: 'Send VK Teams notification'
inputs:
result:
required: false
default: "failure"
type: string
name:
required: false
type: string
default: build
runs:
using: 'composite'
steps:
- name: Resolve token/from env if missing
shell: bash
run: |
if [ -z "${{ inputs.token }}" ] && [ -n "${VK_TEAMS_BOT_TOKEN}" ]; then
echo "token=${VK_TEAMS_BOT_TOKEN}" >> $GITHUB_ENV
fi
if [ -z "${{ inputs.to }}" ] && [ -n "${VK_TEAMS_CHAT_ID}" ]; then
echo "to=${VK_TEAMS_CHAT_ID}" >> $GITHUB_ENV
fi
- name: Set icon
id: icon
shell: bash
run: |
case "${{ inputs.result }}" in
success) echo "ICON=✅" >> $GITHUB_ENV ;;
failure) echo "ICON=❌" >> $GITHUB_ENV ;;
canceled) echo "ICON=🤦" >> $GITHUB_ENV ;;
started) echo "ICON=⚠️" >> $GITHUB_ENV ;;
*) echo "ICON=" >> $GITHUB_ENV ;;
esac
- name: Notify VK Teams
uses: dosymep/vk-teams-action@v1.0.0
with:
token: ${{ secrets.VK_TEAMS_BOT_TOKEN }}
to: ${{ secrets.VK_TEAMS_CHAT_ID }}
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
- 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."