-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
90 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,102 @@ | ||
name: Telegram Notifications | ||
name: Telegram Notification | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
types: [ opened, closed, reopened ] | ||
types: [opened, closed, reopened] | ||
issues: | ||
types: [ opened, closed, reopened ] | ||
types: [opened, closed, reopened] | ||
release: | ||
types: [ published ] | ||
types: [published] | ||
|
||
jobs: | ||
notify: | ||
name: Notify Telegram | ||
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 }} | ||
format: html | ||
message: | | ||
<b>New push to ${{ github.repository }}</b> | ||
Branch: <code>${{ github.ref_name }}</code> | ||
Committer: ${{ github.event.pusher.name }} | ||
Commit message: <i>${{ github.event.head_commit.message }}</i> | ||
Changes: | ||
• Added: ${{ github.event.head_commit.added.length }} file(s) | ||
• Modified: ${{ github.event.head_commit.modified.length }} file(s) | ||
• Removed: ${{ github.event.head_commit.removed.length }} file(s) | ||
<a href="${{ github.event.head_commit.url }}">View commit details</a> | ||
- 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 }} | ||
format: html | ||
message: | | ||
<b>Pull Request ${{ github.event.action }}</b> | ||
Title: ${{ github.event.pull_request.title }} | ||
PR #${{ github.event.pull_request.number }} | ||
Author: ${{ github.event.pull_request.user.login }} | ||
Base branch: <code>${{ github.event.pull_request.base.ref }}</code> | ||
Head branch: <code>${{ github.event.pull_request.head.ref }}</code> | ||
Status: ${{ github.event.pull_request.state }} | ||
${{ github.event.pull_request.additions }} addition(s), ${{ github.event.pull_request.deletions }} deletion(s) | ||
${{ github.event.pull_request.body }} | ||
<a href="${{ github.event.pull_request.html_url }}">View Pull Request</a> | ||
- 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 }} | ||
format: html | ||
message: | | ||
<b>Issue ${{ github.event.action }}</b> | ||
Title: ${{ github.event.issue.title }} | ||
Issue #${{ github.event.issue.number }} | ||
Author: ${{ github.event.issue.user.login }} | ||
Labels: ${{ join(github.event.issue.labels.*.name, ', ') }} | ||
${{ github.event.issue.body }} | ||
<a href="${{ github.event.issue.html_url }}">View Issue</a> | ||
- 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 }} | ||
format: html | ||
message: | | ||
<b>New Release Published</b> | ||
Version: ${{ github.event.release.tag_name }} | ||
Name: ${{ github.event.release.name }} | ||
Author: ${{ github.event.release.author.login }} | ||
Created at: ${{ github.event.release.created_at }} | ||
${{ github.event.release.body }} | ||
<a href="${{ github.event.release.html_url }}">View Release</a> | ||
- 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 }} | ||
format: markdown | ||
message: | | ||
*New Push to ${{ github.repository }}* | ||
*Branch:* `${{ github.ref_name }}` | ||
*Pusher:* ${{ github.actor }} | ||
*Commit Message:* | ||
``` | ||
${{ github.event.head_commit.message }} | ||
``` | ||
[View Commit](https://github.com/${{ github.repository }}/commit/${{github.sha}}) | ||
- 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 }} | ||
format: markdown | ||
message: | | ||
*Pull Request ${{ github.event.action }} in ${{ github.repository }}* | ||
*Title:* ${{ github.event.pull_request.title }} | ||
*PR #:* ${{ github.event.pull_request.number }} | ||
*State:* ${{ github.event.pull_request.state }} | ||
*Author:* ${{ github.event.pull_request.user.login }} | ||
[View PR](${{ 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 }} | ||
format: markdown | ||
message: | | ||
*Issue ${{ github.event.action }} in ${{ github.repository }}* | ||
*Title:* ${{ github.event.issue.title }} | ||
*Issue #:* ${{ github.event.issue.number }} | ||
*State:* ${{ github.event.issue.state }} | ||
*Author:* ${{ github.event.issue.user.login }} | ||
[View Issue](${{ 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 }} | ||
format: markdown | ||
message: | | ||
*New Release Published in ${{ github.repository }}* | ||
*Tag:* ${{ github.event.release.tag_name }} | ||
*Name:* ${{ github.event.release.name }} | ||
*Author:* ${{ github.event.release.author.login }} | ||
*Description:* | ||
``` | ||
${{ github.event.release.body }} | ||
``` | ||
[View Release](${{ github.event.release.html_url }}) | ||
- name: Send Telegram Message on Failure | ||
if: failure() | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_TO }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
message: | | ||
❌ Workflow failed in ${{ github.repository }} | ||
Event: ${{ github.event_name }} | ||
See details: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |