mirror of
https://github.com/appleboy/telegram-action.git
synced 2026-05-14 02:42:44 +00:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 040616c1f8 | |||
| a10dfd2766 | |||
| c83985c531 | |||
| 2b5a500551 | |||
| fdf386abfa | |||
| 4e83d473fc | |||
| a14c43a7be | |||
| 82f08879c5 | |||
| f622f39b03 | |||
| 89073d4db2 | |||
| 7952082356 | |||
| 4dbe08d34a | |||
| ffc52f02f2 | |||
| 8920bdffe3 | |||
| d1f5f0e4e9 | |||
| cba7edda6f | |||
| 868c74871e | |||
| 3fb31034d1 | |||
| d753c01b96 | |||
| 6399a5ed49 | |||
| 0e92df9a00 | |||
| 2df95b048f | |||
| bd94f12bb6 | |||
| 827b11092f | |||
| dcd986dc36 | |||
| 27dde9c826 | |||
| cc178efb9f | |||
| 8b27ddeb0a | |||
| 1274de63b5 | |||
| cc9853533f | |||
| 177c9a4bdc | |||
| 55cc55bcf2 |
@@ -1,24 +0,0 @@
|
|||||||
workflow "Send Notification" {
|
|
||||||
on = "push"
|
|
||||||
resolves = [
|
|
||||||
"Send Custom Message",
|
|
||||||
"Send Default Message"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
action "Send Custom Message" {
|
|
||||||
uses = "appleboy/telegram-action@master"
|
|
||||||
secrets = [
|
|
||||||
"TELEGRAM_TOKEN",
|
|
||||||
"TELEGRAM_TO",
|
|
||||||
]
|
|
||||||
args = "A new commit has been pushed."
|
|
||||||
}
|
|
||||||
|
|
||||||
action "Send Default Message" {
|
|
||||||
uses = "appleboy/telegram-action@master"
|
|
||||||
secrets = [
|
|
||||||
"TELEGRAM_TOKEN",
|
|
||||||
"TELEGRAM_TO",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
name: telegram message
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: send custom message with args
|
||||||
|
uses: appleboy/telegram-action@master
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
|
with:
|
||||||
|
args: The ${{ github.event_name }} event triggered first step.
|
||||||
|
|
||||||
|
- name: send message useing with
|
||||||
|
uses: appleboy/telegram-action@master
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
|
with:
|
||||||
|
message: The ${{ github.event_name }} event triggered second step.
|
||||||
|
|
||||||
|
- name: send default message
|
||||||
|
uses: appleboy/telegram-action@master
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
|
|
||||||
|
- name: send photo message
|
||||||
|
uses: appleboy/telegram-action@master
|
||||||
|
with:
|
||||||
|
message: send photo message
|
||||||
|
photo: './tests/github.png'
|
||||||
|
document: './tests/gophercolor.png'
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
|
|
||||||
|
- name: send location message
|
||||||
|
uses: appleboy/telegram-action@master
|
||||||
|
with:
|
||||||
|
location: '24.9163213 121.1424972'
|
||||||
|
venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
|
|
||||||
|
- name: send custom message
|
||||||
|
uses: appleboy/telegram-action@master
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
|
with:
|
||||||
|
message: |
|
||||||
|
The ${{ github.event_name }} event triggered final step.
|
||||||
|
echo This event is a pull request that had an assignee removed.
|
||||||
+4
-12
@@ -1,16 +1,8 @@
|
|||||||
FROM appleboy/drone-telegram:1.4.1-linux-amd64
|
FROM appleboy/drone-telegram:1.3.1-linux-amd64
|
||||||
|
|
||||||
# Github labels
|
|
||||||
LABEL "com.github.actions.name"="Telegram Notify"
|
|
||||||
LABEL "com.github.actions.description"="Sending a Telegram message"
|
|
||||||
LABEL "com.github.actions.icon"="message-square"
|
|
||||||
LABEL "com.github.actions.color"="blue"
|
|
||||||
|
|
||||||
LABEL "repository"="https://github.com/appleboy/telegram-action"
|
|
||||||
LABEL "homepage"="https://github.com/appleboy"
|
|
||||||
LABEL "maintainer"="Bo-Yi Wu <appleboy.tw@gmail.com>"
|
|
||||||
LABEL "version"="0.0.2"
|
|
||||||
|
|
||||||
ADD entrypoint.sh /entrypoint.sh
|
ADD entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
WORKDIR /github/workspace
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
@@ -2,36 +2,91 @@
|
|||||||
|
|
||||||
[GitHub Action](https://developer.github.com/actions/) for sending a Telegram notification message.
|
[GitHub Action](https://developer.github.com/actions/) for sending a Telegram notification message.
|
||||||
|
|
||||||
<img src="./images/telegram-notification.png">
|

|
||||||
|
|
||||||
|
[](https://github.com/appleboy/facebook-action/actions)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Send custom message as blow
|
Send custom message and see the custom variable as blow.
|
||||||
|
|
||||||
```
|
```yml
|
||||||
action "Send Custom Message" {
|
- name: send custom message
|
||||||
uses = "appleboy/telegram-action@master"
|
uses: appleboy/telegram-action@master
|
||||||
secrets = [
|
env:
|
||||||
"TELEGRAM_TOKEN",
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
"TELEGRAM_TO",
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
]
|
with:
|
||||||
args = "A new commit has been pushed."
|
args: The ${{ github.event_name }} event triggered first step.
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Send the default message. Please remove args
|
Remove `args` to send the default message.
|
||||||
|
|
||||||
```
|
```yml
|
||||||
action "Send Default Message" {
|
- name: send default message
|
||||||
uses = "appleboy/telegram-action@master"
|
uses: appleboy/telegram-action@master
|
||||||
secrets = [
|
env:
|
||||||
"TELEGRAM_TOKEN",
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
"TELEGRAM_TO",
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
<img src="images/telegram-workflow.png">
|

|
||||||
|
|
||||||
|
## Input variables
|
||||||
|
|
||||||
|
* photo - optional. photo message
|
||||||
|
* document - optional. document message
|
||||||
|
* sticker - optional. sticker message
|
||||||
|
* audio - optional. audio message
|
||||||
|
* voice - optional. voice message
|
||||||
|
* location - optional. location message
|
||||||
|
* venue - optional. venue message
|
||||||
|
* video - optional. video message
|
||||||
|
* debug - optional. enable debug mode
|
||||||
|
* format - optional. `markdown` or `html`
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
send photo message:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
- name: send photo message
|
||||||
|
uses: appleboy/telegram-action@master
|
||||||
|
with:
|
||||||
|
message: send photo message
|
||||||
|
photo: tests/github.png
|
||||||
|
document: tests/gophercolor.png
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
|
```
|
||||||
|
|
||||||
|
send location message:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
- name: send location message
|
||||||
|
uses: appleboy/telegram-action@master
|
||||||
|
with:
|
||||||
|
location: '24.9163213 121.1424972'
|
||||||
|
venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
|
```
|
||||||
|
|
||||||
|
send custom message:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
- name: send custom message
|
||||||
|
uses: appleboy/telegram-action@master
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
|
with:
|
||||||
|
message: |
|
||||||
|
The ${{ github.event_name }} event triggered final step.
|
||||||
|
echo This event is a pull request that had an assignee removed.
|
||||||
|
```
|
||||||
|
|
||||||
## Secrets
|
## Secrets
|
||||||
|
|
||||||
@@ -42,8 +97,8 @@ Getting started with [Telegram Bot API](https://core.telegram.org/bots/api).
|
|||||||
|
|
||||||
How to get unique identifier from telegram api:
|
How to get unique identifier from telegram api:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ curl https://api.telegram.org/bot<token>/getUpdates
|
curl https://api.telegram.org/bot<token>/getUpdates
|
||||||
```
|
```
|
||||||
|
|
||||||
See the result: (get chat id like `65382999`)
|
See the result: (get chat id like `65382999`)
|
||||||
@@ -78,3 +133,17 @@ See the result: (get chat id like `65382999`)
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Template variable
|
||||||
|
|
||||||
|
| Github Variable | Telegram Template Variable |
|
||||||
|
|-------------------|----------------------------|
|
||||||
|
| GITHUB_REPOSITORY | repo |
|
||||||
|
| GITHUB_ACTOR | repo.namespace |
|
||||||
|
| GITHUB_SHA | commit.sha |
|
||||||
|
| GITHUB_REF | commit.ref |
|
||||||
|
| GITHUB_WORKFLOW | github.workflow |
|
||||||
|
| GITHUB_ACTION | github.action |
|
||||||
|
| GITHUB_EVENT_NAME | github.event.name |
|
||||||
|
| GITHUB_EVENT_PATH | github.event.path |
|
||||||
|
| GITHUB_WORKSPACE | github.workspace |
|
||||||
|
|||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
name: 'Telegram Message Notify'
|
||||||
|
description: 'Sending a Telegram message'
|
||||||
|
author: 'Bo-Yi Wu'
|
||||||
|
inputs:
|
||||||
|
photo:
|
||||||
|
description: 'send the photo message.'
|
||||||
|
document:
|
||||||
|
description: 'send the document message.'
|
||||||
|
sticker:
|
||||||
|
description: 'send the sticker message.'
|
||||||
|
audio:
|
||||||
|
description: 'send the audio message.'
|
||||||
|
voice:
|
||||||
|
description: 'send the voice message.'
|
||||||
|
location:
|
||||||
|
description: 'send the location message.'
|
||||||
|
venue:
|
||||||
|
description: 'send the venue message.'
|
||||||
|
video:
|
||||||
|
description: 'send the video message.'
|
||||||
|
debug:
|
||||||
|
description: 'enable debug mode.'
|
||||||
|
format:
|
||||||
|
description: 'message format: markdown or html'
|
||||||
|
runs:
|
||||||
|
using: 'docker'
|
||||||
|
image: 'Dockerfile'
|
||||||
|
|
||||||
|
branding:
|
||||||
|
icon: 'message-square'
|
||||||
|
color: 'blue'
|
||||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user