From c13bc5c6aa0368892de40efc5c6b15d449feebb6 Mon Sep 17 00:00:00 2001 From: p0n1 Date: Wed, 25 Sep 2024 19:00:14 +0800 Subject: [PATCH] ci: notify --- .github/workflows/notify.yml | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/notify.yml diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml new file mode 100644 index 0000000..44c4ee6 --- /dev/null +++ b/.github/workflows/notify.yml @@ -0,0 +1,58 @@ +name: Telegram Notifications + +on: + push: + branches: [ main ] + pull_request: + types: [ opened, closed, reopened ] + issues: + types: [ opened, closed, reopened ] + release: + types: [ published ] + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Send Telegram Message on Push + if: github.event_name == 'push' + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + New push to ${{ github.repository }} + Commit message: ${{ github.event.head_commit.message }} + + - name: Send Telegram Message on Pull Request + if: github.event_name == 'pull_request' + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + ${{ github.event.pull_request.title }} (${{ github.event.action }}) + PR #${{ github.event.pull_request.number }} + ${{ github.event.pull_request.html_url }} + + - name: Send Telegram Message on Issue + if: github.event_name == 'issues' + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Issue ${{ github.event.issue.title }} (${{ github.event.action }}) + #${{ github.event.issue.number }} + ${{ github.event.issue.html_url }} + + - name: Send Telegram Message on Release + if: github.event_name == 'release' + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + New release published: ${{ github.event.release.tag_name }} + ${{ github.event.release.name }} + ${{ github.event.release.html_url }} \ No newline at end of file