From a11bec63b9fbfc5301ab703b93256e9ddcab4d49 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 15 Oct 2025 16:08:41 +0300 Subject: [PATCH] native variant --- .gitea/actions/vk-notify/action.yaml | 55 +++++++++++++--------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/.gitea/actions/vk-notify/action.yaml b/.gitea/actions/vk-notify/action.yaml index 11a6a91..a5ad27c 100644 --- a/.gitea/actions/vk-notify/action.yaml +++ b/.gitea/actions/vk-notify/action.yaml @@ -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." \ No newline at end of file + # Отправка запроса + 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 \ No newline at end of file -- 2.49.1