name: Notify Telegram on Issues and Pull Requests

on:
  issues:
    types: [opened, edited, reopened]
  pull_request:
    types: [opened, edited, reopened, review_requested, ready_for_review, synchronize]
  issue_comment:
    types: [created]
  pull_request_review:
    types: [submitted]

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: send telegram message on push
        uses: appleboy/telegram-action@master
        with:
          to: ${{ secrets.TELEGRAM_CHAT_ID }}
          token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
          message: |            
            Repository: ${{ github.repository }}
            Type: ${{ github.event_name }}
            Action: ${{ github.event.action }}
            Titile: ${{ github.event.issue.title || github.event.pull_request.title || 'Комментарий' }}
            ${{github.event.comment.body || ''}}
            See ${{ github.event.issue.html_url || github.event.pull_request.html_url || github.event.comment.html_url || github.event.review.html_url }}
