Skip to content
Snippets Groups Projects
action.yml 1.09 KiB
Newer Older
name: Send VK Teams notification on failure
description: Send the message to VK Teams chat on failure

inputs:
  bot-token:
    required: true
    description: VK Teams bot token
  chat-id:
    required: false
    default: tt_cicd_reports
    description: VK Teams chat ID
  using: composite
  steps:
    - name: Set chat for reports
      run: |
        # Report failures occurred in the 'master' and release branches to
        # the team chat. Report failures occurred in PRs and other branches
        # to the personal chat.
        if [[ ${{ github.ref }} == refs/heads/master ||
              ${{ github.ref }} =~ refs/heads/[0-9].[0-9]+$ ||
              ${{ github.actor }} == TarantoolBot ]]; then
          echo CHAT_ID="${{ inputs.chat-id }}" | tee -a $GITHUB_ENV
        else
          echo CHAT_ID="${{ inputs.chat-id }}_${{ github.actor }}" \
            | tee -a $GITHUB_ENV
        fi
      shell: bash

    - name: Send VK Teams message on failure
      uses: tarantool/actions/report-job-status@master
      with:
        bot-token: ${{ inputs.bot-token }}
        chat-id: ${{ env.CHAT_ID }}