Merge branch 'main' into change-deploy

This commit is contained in:
2025-11-19 07:47:47 +00:00
5 changed files with 182 additions and 93 deletions

View File

@@ -1,31 +0,0 @@
name: 'notify'
description: 'notify'
inputs:
result:
required: false
default: "failure"
type: string
name:
required: false
type: string
default: build
secrets:
required: false
type: string
runs:
using: 'composite'
steps:
- uses: dosymep/vk-teams-action@v1.0.0
env:
ICONS: '{"success":"✅","failure":"❌","canceled":"🤦","started":"⚠️"}'
with:
token: ${{ fromJSON(inputs.secrets).VK_TEAMS_BOT_TOKEN }}
to: ${{ fromJSON(inputs.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 }} ${{ fromJson(env.ICONS)[inputs.result] }}

View File

@@ -0,0 +1,60 @@
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 (native)
if: always()
shell: bash
continue-on-error: true
run: |
echo "[DEBUG] Sending VK Teams notification..."
curl -G "https://myteam.mail.ru/bot/v1/messages/sendText" \
--data-urlencode "token=${{ env.token }}" \
--data-urlencode "chatId=${{ env.to }}" \
--data-urlencode "parseMode=MarkdownV2" \
--data-urlencode "text=*${{ github.repository }}* - [${{ inputs.name }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}) was *${{ inputs.result }}* by ${{ github.event.sender.login }} ${{ env.ICON }}"
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