update readme

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2019-09-25 18:58:09 +08:00
parent 6399a5ed49
commit d753c01b96
+30 -33
View File
@@ -2,36 +2,35 @@
[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"> ![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)
## Usage ## Usage
Send custom message and see the custom variable 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. commit sha: {{ commit.sha }}" args: The ${{ github.event_name }} event triggered first step.
}
``` ```
Remove `args` to send the default message. 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"> ![workflow](./images/telegram-workflow.png)
## Environment variables ## Environment variables
@@ -48,18 +47,16 @@ action "Send Default Message" {
### Example ### Example
``` ```yml
action "Send photo message" { - name: send photo message
uses = "appleboy/telegram-action@master" uses: appleboy/telegram-action@master
secrets = [ with:
"TELEGRAM_TOKEN", message: send photo message
"TELEGRAM_TO", photo: tests/github.png
] document: tests/gophercolor.png
env = { env:
PHOTO = "tests/github.png" TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
} TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
args = "A new commit has been pushed."
}
``` ```
## Secrets ## Secrets
@@ -71,8 +68,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`)