43 Commits

Author SHA1 Message Date
Bo-Yi Wu 65a4c9fc42 chore: add test in file template 2019-11-02 14:52:07 +08:00
Bo-Yi Wu ee6f548104 chore: update format 2019-11-02 14:50:12 +08:00
Bo-Yi Wu 62444e6582 chore: add message_file 2019-11-02 14:33:19 +08:00
Bo-Yi Wu 406cbeb82a chore: upgrade to 1.3.4 2019-11-02 14:24:25 +08:00
Bo-Yi Wu a5e94a4245 docs: update status link 2019-10-13 01:30:14 +08:00
Bo-Yi Wu 40cbdc99a4 chore: upgrade drone-telegram 2019-10-13 00:12:05 +08:00
Bo-Yi Wu ac4245365c Update README.md 2019-09-30 11:37:12 +08:00
Bo-Yi Wu 06cc7371ce docs: update readme 2019-09-29 14:18:21 +08:00
Bo-Yi Wu b535a89bc8 docs: add checkout command 2019-09-28 11:19:32 +08:00
Bo-Yi Wu 696643cdf6 chore: checkout source code. 2019-09-28 11:17:35 +08:00
Bo-Yi Wu bd65e6f3ea docs: update badge url 2019-09-25 22:42:29 +08:00
Bo-Yi Wu 040616c1f8 chore: add drone telegram version 2019-09-25 22:39:32 +08:00
Bo-Yi Wu a10dfd2766 docs: add custom message 2019-09-25 22:12:11 +08:00
Bo-Yi Wu c83985c531 add custom message
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 22:09:04 +08:00
Bo-Yi Wu 2b5a500551 docs: add photo and location message 2019-09-25 22:04:09 +08:00
Bo-Yi Wu fdf386abfa docs: update location message 2019-09-25 22:02:38 +08:00
Bo-Yi Wu 4e83d473fc update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 22:01:27 +08:00
Bo-Yi Wu a14c43a7be chore: add location message 2019-09-25 21:28:25 +08:00
Bo-Yi Wu 82f08879c5 docs: add location message 2019-09-25 21:22:36 +08:00
Bo-Yi Wu f622f39b03 chore: add location message 2019-09-25 21:21:38 +08:00
Bo-Yi Wu 89073d4db2 update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 19:28:57 +08:00
Bo-Yi Wu 7952082356 update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 19:27:38 +08:00
Bo-Yi Wu 4dbe08d34a update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 19:25:53 +08:00
Bo-Yi Wu ffc52f02f2 update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 19:23:28 +08:00
Bo-Yi Wu 8920bdffe3 update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 19:20:36 +08:00
Bo-Yi Wu d1f5f0e4e9 add workspace
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 19:15:08 +08:00
Bo-Yi Wu cba7edda6f update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 19:13:06 +08:00
Bo-Yi Wu 868c74871e add workdir
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 19:08:49 +08:00
Bo-Yi Wu 3fb31034d1 initial ci
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 18:59:58 +08:00
Bo-Yi Wu d753c01b96 update readme
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 18:58:09 +08:00
Bo-Yi Wu 6399a5ed49 upgrade github actions
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 18:53:47 +08:00
Bo-Yi Wu 0e92df9a00 add action yaml file.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-25 18:41:37 +08:00
Bo-Yi Wu 2df95b048f fixed Template typo (#3)
fixed Template typo
2019-04-26 09:46:49 +08:00
0xflotus bd94f12bb6 fixed Template typo 2019-04-24 18:09:13 +02:00
Bo-Yi Wu 827b11092f docs: update doc 2019-04-05 07:20:52 +08:00
Bo-Yi Wu dcd986dc36 Merge pull request #2 from appleboy/doc
docs: add Template variable
2019-04-05 07:14:33 +08:00
Bo-Yi Wu 27dde9c826 docs: add Template variable 2019-04-05 07:10:58 +08:00
Bo-Yi Wu cc178efb9f chore: add commit.sha in example 2019-04-05 06:48:58 +08:00
Bo-Yi Wu 8b27ddeb0a docs: add FORMAT env info 2019-02-28 15:09:39 +08:00
Bo-Yi Wu 1274de63b5 chore(workflow): add test message 2019-02-20 00:23:44 +08:00
Bo-Yi Wu cc9853533f chore: update docker image 2019-02-19 23:55:36 +08:00
Bo-Yi Wu 177c9a4bdc feat: add Environment variables 2019-02-19 23:49:54 +08:00
Bo-Yi Wu 55cc55bcf2 docs: update text 2019-02-19 21:01:53 +08:00
12 changed files with 211 additions and 60 deletions
-24
View File
@@ -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",
]
}
+61
View File
@@ -0,0 +1,61 @@
name: telegram message
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: send custom message with args
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
args: The ${{ github.event_name }} event triggered first step.
- name: send message useing with
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: The ${{ github.event_name }} event triggered second step.
- name: send default message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
- name: send photo message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: send photo message
photo: './tests/github.png'
document: './tests/gophercolor.png'
- name: send location message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
location: '24.9163213 121.1424972'
venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
- name: send custom message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
The ${{ github.event_name }} event triggered final step.
echo This event is a pull request that had an assignee removed.
- name: send message file
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message_file: tests/message.txt
+4 -12
View File
@@ -1,16 +1,8 @@
FROM appleboy/drone-telegram:1.4.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"
FROM appleboy/drone-telegram:1.3.4-linux-amd64
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
WORKDIR /github/workspace
ENTRYPOINT ["/entrypoint.sh"]
+104 -24
View File
@@ -1,37 +1,103 @@
# 🚀 Telegram for GitHub Actions
[GitHub Action](https://developer.github.com/actions/) for sending a Telegram notification message.
[GitHub Action](https://github.com/features/actions) for sending a Telegram notification message.
<img src="./images/telegram-notification.png">
![notification](./images/telegram-notification.png)
[![Actions Status](https://github.com/appleboy/telegram-action/workflows/telegram%20message/badge.svg)](https://github.com/appleboy/telegram-action/actions)
## Usage
Send custom message as blow
Send custom message and see the custom variable as blow.
```
action "Send Custom Message" {
uses = "appleboy/telegram-action@master"
secrets = [
"TELEGRAM_TOKEN",
"TELEGRAM_TO",
]
args = "A new commit has been pushed."
}
```yml
name: telegram message
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- 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.
```
Send the default message. Please remove args
Remove `args` to send the default message.
```
action "Send Default Message" {
uses = "appleboy/telegram-action@master"
secrets = [
"TELEGRAM_TOKEN",
"TELEGRAM_TO",
]
}
```yml
- name: send default message
uses: appleboy/telegram-action@master
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
```
<img src="images/telegram-workflow.png">
![workflow](./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`
* message_file - optional. overwrite the default message template with the contents of the specified file.
### Example
send photo message:
```yml
- uses: actions/checkout@master
- 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
@@ -42,8 +108,8 @@ Getting started with [Telegram Bot API](https://core.telegram.org/bots/api).
How to get unique identifier from telegram api:
```
$ curl https://api.telegram.org/bot<token>/getUpdates
```bash
curl https://api.telegram.org/bot<token>/getUpdates
```
See the result: (get chat id like `65382999`)
@@ -78,3 +144,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 |
+39
View File
@@ -0,0 +1,39 @@
name: 'Telegram Message Notify'
description: 'Sending a Telegram message'
author: 'Bo-Yi Wu'
inputs:
to:
description: 'telegram user'
token:
description: 'telegram token'
message:
description: 'telegram message'
message_file:
description: 'overwrite the default message template with the contents of the specified file'
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'
BIN
View File
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

+3
View File
@@ -0,0 +1,3 @@
Sample message loaded from file.
Commit msg: {{commit.message}}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.