From 4cff5eb8141c7d746d37708f937ace4c7f1de944 Mon Sep 17 00:00:00 2001 From: sahalsaad Date: Mon, 28 Oct 2019 10:14:14 +0800 Subject: [PATCH] Implement sendChatAction to show the status --- README.md | 27 +++++++++++++++++++++++++++ src/commands/showStatus.yml | 34 ++++++++++++++++++++++++++++++++++ src/examples/showStatus.yml | 20 ++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 src/commands/showStatus.yml create mode 100644 src/examples/showStatus.yml diff --git a/README.md b/README.md index ebb794b..60ad06b 100755 --- a/README.md +++ b/README.md @@ -180,6 +180,33 @@ jobs: image-url: "https://www.example.com/img.jpg" ``` +### ShowStatus + +A command which sets the action status to the specified Telegram chat. + +| Parameter | Type | Default | Description | +| -------------------- | -------------- | ------------------ | ------------------------------------------------------------ | +| `telegram-bot-token` | `env_var_name` | TELEGRAM_BOT_TOKEN | Name of environment variable storing your Telegram bot token | +| `telegram-chat-id` | `env_var_name` | TELEGRAM_CHAT_ID | Name of environment variable storing your Telegram chat id | +| `telegram-action` | `string` | | Enter an action type | + +Example: + +```yaml +version: 2.1 + +orbs: + telegram: woltsu/telegram@x.y.z + +jobs: + build: + docker: + - image: + steps: + - telegram/showstatus: + telegram-action: "upload_document" +``` + ## Jobs ### Notify diff --git a/src/commands/showStatus.yml b/src/commands/showStatus.yml new file mode 100644 index 0000000..aac9c07 --- /dev/null +++ b/src/commands/showStatus.yml @@ -0,0 +1,34 @@ +description: > + Show the action status + +parameters: + telegram-bot-token: + type: env_var_name + default: TELEGRAM_BOT_TOKEN + description: > + Name of environment variable storing your Telegram bot token + + telegram-chat-id: + type: env_var_name + default: TELEGRAM_CHAT_ID + description: > + Name of environment variable storing your Telegram chat id + + telegram-action: + type: string + default: "" + description: > + Enter an action type + +steps: + - run: + name: Show action status + shell: /bin/bash + command: | + if [ -z <> ] + then + echo "Please specify an action type." + else + + curl "https://api.telegram.org/bot$<>/sendChatAction?chat_id=$<>&action=<>" + fi diff --git a/src/examples/showStatus.yml b/src/examples/showStatus.yml new file mode 100644 index 0000000..2e6605f --- /dev/null +++ b/src/examples/showStatus.yml @@ -0,0 +1,20 @@ +description: "Send a action status." + +usage: + version: 2.1 + + orbs: + telegram: woltsu/telegram@x.y.z + + jobs: + build: + docker: + - image: + steps: + - telegram/showstatus: + telegram-action: "upload_document" + + workflows: + your-workflow: + jobs: + - build