15 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
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
Bo-Yi Wu 11eac4982b fix: author homepage. 2019-02-17 16:58:22 +08:00
Bo-Yi Wu e8ea5ee34f chore: update base docker image. 2019-02-17 16:56:39 +08:00
Bo-Yi Wu 2eee0c6ce3 docs: update 2019-02-17 16:33:00 +08:00
Bo-Yi Wu bd236a6c5a fix: check empty 2019-02-17 16:28:51 +08:00
Bo-Yi Wu a155de7800 fix: enable GitHub env 2019-02-17 16:14:00 +08:00
Bo-Yi Wu 4025d6255a feat: support default message 2019-02-17 16:10:25 +08:00
11 changed files with 80 additions and 15 deletions
+27 -2
View File
@@ -1,9 +1,13 @@
workflow "Send Notification" {
on = "push"
resolves = ["Post message to Telegram"]
resolves = [
"Send Custom Message",
"Send Default Message",
"Send Photo Message",
]
}
action "Post message to Telegram" {
action "Send Custom Message" {
uses = "appleboy/telegram-action@master"
secrets = [
"TELEGRAM_TOKEN",
@@ -11,3 +15,24 @@ action "Post message to Telegram" {
]
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."
}
+5 -11
View File
@@ -1,21 +1,15 @@
FROM golang:1.11
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 notification message"
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/Ilshidur/actions"
LABEL "homepage"="https://github.com/appleboy/telegram-action"
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.1"
ENV TELEGRAM_VERSION=1.4.0
ENV OS_ARCH=linux-amd64
RUN wget https://github.com/appleboy/drone-telegram/releases/download/${TELEGRAM_VERSION}/drone-telegram-${TELEGRAM_VERSION}-${OS_ARCH} -O /bin/drone-telegram
RUN chmod +x /bin/drone-telegram
LABEL "version"="0.0.2"
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
+45 -1
View File
@@ -6,8 +6,10 @@
## Usage
Send custom message as blow
```
action "Post message to Telegram" {
action "Send Custom Message" {
uses = "appleboy/telegram-action@master"
secrets = [
"TELEGRAM_TOKEN",
@@ -17,6 +19,48 @@ action "Post message to Telegram" {
}
```
Remove `args` to send the default message.
```
action "Send Default Message" {
uses = "appleboy/telegram-action@master"
secrets = [
"TELEGRAM_TOKEN",
"TELEGRAM_TO",
]
}
```
<img src="images/telegram-workflow.png">
## 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
### Example
```
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
Getting started with [Telegram Bot API](https://core.telegram.org/bots/api).
+3 -1
View File
@@ -2,6 +2,8 @@
set -eu
export TELEGRAM_MESSAGE="$*"
export GITHUB="true"
[ -n "$*" ] && export TELEGRAM_MESSAGE="$*"
/bin/drone-telegram
Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

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

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.