Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement sendChatAction to show the status #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]

jobs:
build:
docker:
- image: <docker image>
steps:
- telegram/showstatus:
telegram-action: "upload_document"
```

## Jobs

### Notify
Expand Down
34 changes: 34 additions & 0 deletions src/commands/showStatus.yml
Original file line number Diff line number Diff line change
@@ -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 <<parameters.telegram-action>> ]
then
echo "Please specify an action type."
else

curl "https://api.telegram.org/bot$<<parameters.telegram-bot-token>>/sendChatAction?chat_id=$<<parameters.telegram-chat-id>>&action=<<parameters.telegram-action>>"
fi
20 changes: 20 additions & 0 deletions src/examples/showStatus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
description: "Send a action status."

usage:
version: 2.1

orbs:
telegram: woltsu/[email protected]

jobs:
build:
docker:
- image: <docker image>
steps:
- telegram/showstatus:
telegram-action: "upload_document"

workflows:
your-workflow:
jobs:
- build