6 Commits

Author SHA1 Message Date
Bo-Yi Wu ae54341a85 fix: remove unused env 2019-02-20 00:09:06 +08:00
Bo-Yi Wu 70b64f5beb fix: typo 2019-02-20 00:08:28 +08:00
Bo-Yi Wu 7347add3d3 Update main.workflow 2019-02-20 00:06:40 +08:00
Bo-Yi Wu 6c7afcc8db fix: format 2019-02-20 00:05:13 +08:00
Bo-Yi Wu 372c737013 fix: add document message 2019-02-20 00:00:47 +08:00
Bo-Yi Wu 1b52d8d894 chore(workflow): add test message 2019-02-19 23:58:46 +08:00
5 changed files with 93 additions and 178 deletions
+38
View File
@@ -0,0 +1,38 @@
workflow "Send Notification" {
on = "push"
resolves = [
"Send Custom Message",
"Send Default Message",
"Send Photo 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",
]
}
action "Send Photo Message" {
uses = "appleboy/telegram-action@master"
env = {
PHOTO = "tests/github.png"
DOCUMENT = "tests/gophercolor.png"
}
secrets = [
"TELEGRAM_TOKEN",
"TELEGRAM_TO",
]
args = "send photo message."
}
-59
View File
@@ -1,59 +0,0 @@
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.
+12 -4
View File
@@ -1,8 +1,16 @@
FROM appleboy/drone-telegram:1.3.1-linux-amd64
FROM appleboy/drone-telegram:1.4.2-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
RUN chmod +x /entrypoint.sh
WORKDIR /github/workspace
ENTRYPOINT ["/entrypoint.sh"]
+43 -84
View File
@@ -2,90 +2,63 @@
[GitHub Action](https://developer.github.com/actions/) for sending a Telegram notification message.
![notification](./images/telegram-notification.png)
[![Actions Status](https://github.com/appleboy/facebook-telegram/workflows/telegram%20message/badge.svg)](https://github.com/appleboy/facebook-action/actions)
<img src="./images/telegram-notification.png">
## Usage
Send custom message and see the custom variable as blow.
Send custom message as blow
```yml
- name: send custom message
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.
```
action "Send Custom Message" {
uses = "appleboy/telegram-action@master"
secrets = [
"TELEGRAM_TOKEN",
"TELEGRAM_TO",
]
args = "A new commit has been pushed."
}
```
Remove `args` to send the default message.
```yml
- name: send default message
uses: appleboy/telegram-action@master
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
```
action "Send Default Message" {
uses = "appleboy/telegram-action@master"
secrets = [
"TELEGRAM_TOKEN",
"TELEGRAM_TO",
]
}
```
![workflow](./images/telegram-workflow.png)
<img src="images/telegram-workflow.png">
## Input variables
## Environment 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`
* 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
### 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.
action "Send photo message" {
uses = "appleboy/telegram-action@master"
secrets = [
"TELEGRAM_TOKEN",
"TELEGRAM_TO",
]
env = {
PHOTO = "tests/github.png"
}
args = "A new commit has been pushed."
}
```
## Secrets
@@ -97,8 +70,8 @@ Getting started with [Telegram Bot API](https://core.telegram.org/bots/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`)
@@ -133,17 +106,3 @@ 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
View File
@@ -1,31 +0,0 @@
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'