mirror of
https://github.com/appleboy/telegram-action.git
synced 2026-05-14 10:52:51 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae54341a85 | |||
| 70b64f5beb | |||
| 7347add3d3 | |||
| 6c7afcc8db | |||
| 372c737013 | |||
| 1b52d8d894 |
@@ -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."
|
||||||
|
}
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
name: telegram message
|
|
||||||
on: [push]
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
- name: send custom message with args
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
args: The ${{ github.event_name }} event triggered first step.
|
|
||||||
|
|
||||||
- name: send message using with
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
message: |
|
|
||||||
The ${{ github.event_name }} event triggered second step.
|
|
||||||
show the github variable ref: ${{ github.ref }}
|
|
||||||
show the github variable commit: ${{ github.sha }}
|
|
||||||
show the github variable ref: {{ commit.ref }}
|
|
||||||
show the github variable commit: {{ commit.sha }}
|
|
||||||
Commit Message: ${{ github.event.head_commit.message }}
|
|
||||||
|
|
||||||
- name: send default message
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
|
|
||||||
- name: send photo message
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
message: send photo message
|
|
||||||
photo: "./tests/github.png"
|
|
||||||
document: "./tests/gophercolor.png"
|
|
||||||
|
|
||||||
- name: send location message
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
location: "24.9163213 121.1424972"
|
|
||||||
venue: "35.661777 139.704051 竹北體育館 新竹縣竹北市"
|
|
||||||
|
|
||||||
- name: send custom message
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
message: |
|
|
||||||
The ${{ github.event_name }} event triggered final step.
|
|
||||||
echo This event is a pull request that had an assignee removed.
|
|
||||||
|
|
||||||
- name: send message file
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
message_file: tests/message.txt
|
|
||||||
|
|
||||||
# - name: send message using socks5 proxy URL
|
|
||||||
# uses: appleboy/telegram-action@master
|
|
||||||
# with:
|
|
||||||
# to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
# token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
# socks5: "http://222.124.154.19:23500"
|
|
||||||
# message: Send message from socks5 proxy URL.
|
|
||||||
|
|
||||||
# - name: try multiple message
|
|
||||||
# uses: appleboy/telegram-action@master
|
|
||||||
# with:
|
|
||||||
# to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
# token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
# format: html
|
|
||||||
# message: |
|
|
||||||
# ⚡️ <a href="https://github.com/aszenz/repo/commit/${{ github.event.push.after }}">Commits</a> pushed to master by <em>${{ github.event.push.pusher.name }}</em> ⚡️
|
|
||||||
# ${{ github.actor }}:${{ github.event.head_commit.message }}
|
|
||||||
|
|
||||||
- name: link preview
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
message: |
|
|
||||||
show link preview https://google.com.tw
|
|
||||||
|
|
||||||
- name: disable link preview
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
disable_web_page_preview: true
|
|
||||||
message: |
|
|
||||||
disable link preview https://google.com.tw
|
|
||||||
|
|
||||||
- name: sending a message without notification
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
disable_notification: true
|
|
||||||
message: |
|
|
||||||
disable link preview https://google.com.tw
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
name: Goreleaser
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
goreleaser:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup go
|
|
||||||
uses: actions/setup-go@v6
|
|
||||||
with:
|
|
||||||
go-version: "^1"
|
|
||||||
|
|
||||||
- name: Run GoReleaser
|
|
||||||
uses: goreleaser/goreleaser-action@v7
|
|
||||||
with:
|
|
||||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
|
||||||
distribution: goreleaser
|
|
||||||
version: latest
|
|
||||||
args: release --clean
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
builds:
|
|
||||||
- # If true, skip the build.
|
|
||||||
# Useful for library projects.
|
|
||||||
# Default is false
|
|
||||||
skip: true
|
|
||||||
|
|
||||||
changelog:
|
|
||||||
use: github
|
|
||||||
groups:
|
|
||||||
- title: Features
|
|
||||||
regexp: "^.*feat[(\\w)]*:+.*$"
|
|
||||||
order: 0
|
|
||||||
- title: "Bug fixes"
|
|
||||||
regexp: "^.*fix[(\\w)]*:+.*$"
|
|
||||||
order: 1
|
|
||||||
- title: "Enhancements"
|
|
||||||
regexp: "^.*chore[(\\w)]*:+.*$"
|
|
||||||
order: 2
|
|
||||||
- title: "Refactor"
|
|
||||||
regexp: "^.*refactor[(\\w)]*:+.*$"
|
|
||||||
order: 3
|
|
||||||
- title: "Build process updates"
|
|
||||||
regexp: ^.*?(build|ci)(\(.+\))??!?:.+$
|
|
||||||
order: 4
|
|
||||||
- title: "Documentation updates"
|
|
||||||
regexp: ^.*?docs?(\(.+\))??!?:.+$
|
|
||||||
order: 4
|
|
||||||
- title: Others
|
|
||||||
+13
-5
@@ -1,8 +1,16 @@
|
|||||||
FROM ghcr.io/appleboy/drone-telegram:1.4.0
|
FROM appleboy/drone-telegram:1.4.2-linux-amd64
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
# 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
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
WORKDIR /github/workspace
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
@@ -1,138 +1,77 @@
|
|||||||
# 🚀 Telegram for GitHub Actions
|
# 🚀 Telegram for GitHub Actions
|
||||||
|
|
||||||
[繁體中文](./README.zh-tw.md) | [简体中文](./README.zh-cn.md)
|
[GitHub Action](https://developer.github.com/actions/) for sending a Telegram notification message.
|
||||||
|
|
||||||
[GitHub Action](https://github.com/features/actions) for sending Telegram notification messages.
|
<img src="./images/telegram-notification.png">
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
[](https://github.com/appleboy/telegram-action/actions)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
**Note**: If you receive the "Error: Chat not found" error, please refer to this StackOverflow answer [here](https://stackoverflow.com/a/41291666).
|
Send custom message as blow
|
||||||
|
|
||||||
Send a custom message and view the custom variables below.
|
```
|
||||||
|
action "Send Custom Message" {
|
||||||
```yml
|
uses = "appleboy/telegram-action@master"
|
||||||
name: telegram message
|
secrets = [
|
||||||
on: [push]
|
"TELEGRAM_TOKEN",
|
||||||
jobs:
|
"TELEGRAM_TO",
|
||||||
|
]
|
||||||
build:
|
args = "A new commit has been pushed."
|
||||||
name: Build
|
}
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: send telegram message on push
|
|
||||||
uses: appleboy/telegram-action@master
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
message: |
|
|
||||||
${{ github.actor }} created commit:
|
|
||||||
Commit message: ${{ github.event.commits[0].message }}
|
|
||||||
|
|
||||||
Repository: ${{ github.repository }}
|
|
||||||
|
|
||||||
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove `args` to send the default message.
|
Remove `args` to send the default message.
|
||||||
|
|
||||||
```yml
|
```
|
||||||
- name: send default message
|
action "Send Default Message" {
|
||||||
uses: appleboy/telegram-action@master
|
uses = "appleboy/telegram-action@master"
|
||||||
with:
|
secrets = [
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
"TELEGRAM_TOKEN",
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
"TELEGRAM_TO",
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||

|
<img src="images/telegram-workflow.png">
|
||||||
|
|
||||||
## Input variables
|
## Environment variables
|
||||||
|
|
||||||
| Variable | Description |
|
* PHOTO - Optional. photo message
|
||||||
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
* DOCUMENT - Optional. document message
|
||||||
| socks5 | optional. Support socks5 proxy URL |
|
* STICKER - Optional. sticker message
|
||||||
| photo | optional. Photo message |
|
* AUDIO - Optional. audio message
|
||||||
| document | optional. Document message |
|
* VOICE - Optional. voice message
|
||||||
| sticker | optional. Sticker message |
|
* LOCATION - Optional. location message
|
||||||
| audio | optional. Audio message |
|
* VENUE - Optional. venue message
|
||||||
| voice | optional. Voice message |
|
* VIDEO - Optional. video message
|
||||||
| location | optional. Location message |
|
* DEBUG - Optional. enable debug mode
|
||||||
| venue | optional. Venue message |
|
|
||||||
| video | optional. Video message |
|
|
||||||
| debug | optional. Enable debug mode |
|
|
||||||
| format | optional. `markdown` or `html`. See [MarkdownV2 style](https://core.telegram.org/bots/api#markdownv2-style) |
|
|
||||||
| message | optional. Custom message |
|
|
||||||
| message_file | optional. Overwrite the default message template with the contents of the specified file. |
|
|
||||||
| message_thread_id | optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only. |
|
|
||||||
| disable_web_page_preview | optional. Disables link previews for links in this message. Default is `false`. |
|
|
||||||
| disable_notification | optional. Disables notifications for this message, supports sending a message without notification. Default is `false`. |
|
|
||||||
|
|
||||||
## Example
|
### Example
|
||||||
|
|
||||||
Send photo message:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- name: send photo message
|
|
||||||
uses: appleboy/telegram-action@master
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
message: send photo message
|
|
||||||
photo: tests/github.png
|
|
||||||
document: tests/gophercolor.png
|
|
||||||
```
|
```
|
||||||
|
action "Send photo message" {
|
||||||
Send location message:
|
uses = "appleboy/telegram-action@master"
|
||||||
|
secrets = [
|
||||||
```yml
|
"TELEGRAM_TOKEN",
|
||||||
- name: send location message
|
"TELEGRAM_TO",
|
||||||
uses: appleboy/telegram-action@master
|
]
|
||||||
with:
|
env = {
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
PHOTO = "tests/github.png"
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
}
|
||||||
location: '24.9163213 121.1424972'
|
args = "A new commit has been pushed."
|
||||||
venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
|
}
|
||||||
```
|
|
||||||
|
|
||||||
Send a message to a specific forum topic (thread):
|
|
||||||
|
|
||||||
```yml
|
|
||||||
- name: send message to forum topic
|
|
||||||
uses: appleboy/telegram-action@master
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
message_thread_id: 42
|
|
||||||
message: Hello from GitHub Actions!
|
|
||||||
```
|
|
||||||
|
|
||||||
Send message using custom proxy (support `http`, `https`, and `socks5`) like `socks5://127.0.0.1:1080` or `http://222.124.154.19:23500`
|
|
||||||
|
|
||||||
```yml
|
|
||||||
- name: send message using socks5 proxy URL
|
|
||||||
uses: appleboy/telegram-action@master
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
socks5: "http://222.124.154.19:23500"
|
|
||||||
message: Send message from socks5 proxy URL.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Secrets
|
## Secrets
|
||||||
|
|
||||||
Getting started with [Telegram Bot API](https://core.telegram.org/bots/api).
|
Getting started with [Telegram Bot API](https://core.telegram.org/bots/api).
|
||||||
|
|
||||||
* `token`: Telegram authorization token.
|
* `TELEGRAM_TOKEN`: Telegram authorization token.
|
||||||
* `to`: Unique identifier for this chat.
|
* `TELEGRAM_TO`: Unique identifier for this chat.
|
||||||
|
|
||||||
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`)
|
||||||
@@ -167,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 |
|
|
||||||
|
|||||||
-133
@@ -1,133 +0,0 @@
|
|||||||
# 🚀 GitHub Actions 的 Telegram
|
|
||||||
|
|
||||||
[GitHub Action](https://github.com/features/actions) 用于发送 Telegram 通知消息。
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
[](https://github.com/appleboy/telegram-action/actions)
|
|
||||||
|
|
||||||
## 使用方法
|
|
||||||
|
|
||||||
**注意**:如果您收到 "Error: Chat not found" 错误,请参考这个 stackoverflow 的回答 [这里](https://stackoverflow.com/a/41291666)。
|
|
||||||
|
|
||||||
发送自定义消息并查看如下的自定义变量。
|
|
||||||
|
|
||||||
## 输入变量
|
|
||||||
|
|
||||||
| 变量 | 描述 |
|
|
||||||
| ------------------------ | ------------------------------------------------------------------------------------------------------- |
|
|
||||||
| socks5 | 可选。支持 socks5 代理 URL |
|
|
||||||
| photo | 可选。照片消息 |
|
|
||||||
| document | 可选。文档消息 |
|
|
||||||
| sticker | 可选。贴纸消息 |
|
|
||||||
| audio | 可选。音频消息 |
|
|
||||||
| voice | 可选。语音消息 |
|
|
||||||
| location | 可选。位置消息 |
|
|
||||||
| venue | 可选。场馆消息 |
|
|
||||||
| video | 可选。视频消息 |
|
|
||||||
| debug | 可选。启用调试模式 |
|
|
||||||
| format | 可选。`markdown` 或 `html`。参见 [MarkdownV2 样式](https://core.telegram.org/bots/api#markdownv2-style) |
|
|
||||||
| message | 可选。自定义消息 |
|
|
||||||
| message_file | 可选。用指定文件的内容覆盖默认消息模板。 |
|
|
||||||
| disable_web_page_preview | 可选。禁用此消息中链接的预览。默认值为 `false`。 |
|
|
||||||
| disable_notification | 可选。禁用此消息的通知,支持发送无通知的消息。默认值为 `false`。 |
|
|
||||||
|
|
||||||
## 示例
|
|
||||||
|
|
||||||
发送照片消息:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- name: send photo message
|
|
||||||
uses: appleboy/telegram-action@master
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
message: send photo message
|
|
||||||
photo: tests/github.png
|
|
||||||
document: tests/gophercolor.png
|
|
||||||
```
|
|
||||||
|
|
||||||
发送位置消息:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
- name: send location message
|
|
||||||
uses: appleboy/telegram-action@master
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
location: '24.9163213 121.1424972'
|
|
||||||
venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
|
|
||||||
```
|
|
||||||
|
|
||||||
使用自定义代理发送消息(支持 `http`、`https` 和 `socks5`),如 `socks5://127.0.0.1:1080` 或 `http://222.124.154.19:23500`
|
|
||||||
|
|
||||||
```yml
|
|
||||||
- name: send message using socks5 proxy URL
|
|
||||||
uses: appleboy/telegram-action@master
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
socks5: "http://222.124.154.19:23500"
|
|
||||||
message: Send message from socks5 proxy URL.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Secrets
|
|
||||||
|
|
||||||
开始使用 [Telegram Bot API](https://core.telegram.org/bots/api)。
|
|
||||||
|
|
||||||
* `token`: Telegram 授权令牌。
|
|
||||||
* `to`: 此聊天的唯一标识符。
|
|
||||||
|
|
||||||
如何从 Telegram API 获取唯一标识符:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl https://api.telegram.org/bot<token>/getUpdates
|
|
||||||
```
|
|
||||||
|
|
||||||
查看结果:(获取聊天 ID,如 `65382999`)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"ok": true,
|
|
||||||
"result": [
|
|
||||||
{
|
|
||||||
"update_id": 664568113,
|
|
||||||
"message": {
|
|
||||||
"message_id": 8423,
|
|
||||||
"from": {
|
|
||||||
"id": 65382999,
|
|
||||||
"is_bot": false,
|
|
||||||
"first_name": "Bo-Yi",
|
|
||||||
"last_name": "Wu (appleboy)",
|
|
||||||
"username": "appleboy46",
|
|
||||||
"language_code": "en"
|
|
||||||
},
|
|
||||||
"chat": {
|
|
||||||
"id": 65382999,
|
|
||||||
"first_name": "Bo-Yi",
|
|
||||||
"last_name": "Wu (appleboy)",
|
|
||||||
"username": "appleboy46",
|
|
||||||
"type": "private"
|
|
||||||
},
|
|
||||||
"date": 1550333434,
|
|
||||||
"text": "?"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## 模板变量
|
|
||||||
|
|
||||||
| GitHub 变量 | Telegram 模板变量 |
|
|
||||||
| ----------------- | ----------------- |
|
|
||||||
| 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 |
|
|
||||||
-133
@@ -1,133 +0,0 @@
|
|||||||
# 🚀 Telegram 的 GitHub Actions
|
|
||||||
|
|
||||||
透過 [GitHub Action](https://github.com/features/actions) 發送 Telegram 通知訊息。
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
[](https://github.com/appleboy/telegram-action/actions)
|
|
||||||
|
|
||||||
## 使用方式
|
|
||||||
|
|
||||||
**注意**:如果您收到 "Error: Chat not found" 錯誤,請參考此 stackoverflow 上的回答 [連結](https://stackoverflow.com/a/41291666)。
|
|
||||||
|
|
||||||
發送自訂訊息並參考以下自訂變數。
|
|
||||||
|
|
||||||
## 輸入變數
|
|
||||||
|
|
||||||
| 變數 | 說明 |
|
|
||||||
| ------------------------ | ------------------------------------------------------------------------------------------------------- |
|
|
||||||
| socks5 | 選填。支援 socks5 代理 URL |
|
|
||||||
| photo | 選填。圖片訊息 |
|
|
||||||
| document | 選填。文件訊息 |
|
|
||||||
| sticker | 選填。貼圖訊息 |
|
|
||||||
| audio | 選填。音訊訊息 |
|
|
||||||
| voice | 選填。語音訊息 |
|
|
||||||
| location | 選填。位置訊息 |
|
|
||||||
| venue | 選填。地點訊息 |
|
|
||||||
| video | 選填。影片訊息 |
|
|
||||||
| debug | 選填。啟用除錯模式 |
|
|
||||||
| format | 選填。`markdown` 或 `html`。參見 [MarkdownV2 格式](https://core.telegram.org/bots/api#markdownv2-style) |
|
|
||||||
| message | 選填。自訂訊息 |
|
|
||||||
| message_file | 選填。使用指定檔案的內容覆蓋預設訊息模板 |
|
|
||||||
| disable_web_page_preview | 選填。停用此訊息中連結的預覽。預設為 `false` |
|
|
||||||
| disable_notification | 選填。停用此訊息的通知,支援發送無通知的訊息。預設為 `false` |
|
|
||||||
|
|
||||||
## 範例
|
|
||||||
|
|
||||||
發送圖片訊息:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- name: send photo message
|
|
||||||
uses: appleboy/telegram-action@master
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
message: send photo message
|
|
||||||
photo: tests/github.png
|
|
||||||
document: tests/gophercolor.png
|
|
||||||
```
|
|
||||||
|
|
||||||
發送位置消息:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
- name: send location message
|
|
||||||
uses: appleboy/telegram-action@master
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
location: '24.9163213 121.1424972'
|
|
||||||
venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
|
|
||||||
```
|
|
||||||
|
|
||||||
使用自定義代理發送消息(支持 `http`、`https` 和 `socks5`),如 `socks5://127.0.0.1:1080` 或 `http://222.124.154.19:23500`
|
|
||||||
|
|
||||||
```yml
|
|
||||||
- name: send message using socks5 proxy URL
|
|
||||||
uses: appleboy/telegram-action@master
|
|
||||||
with:
|
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
socks5: "http://222.124.154.19:23500"
|
|
||||||
message: Send message from socks5 proxy URL.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Secrets
|
|
||||||
|
|
||||||
開始使用 [Telegram Bot API](https://core.telegram.org/bots/api)。
|
|
||||||
|
|
||||||
* `token`: Telegram 授權令牌。
|
|
||||||
* `to`: 此聊天的唯一標識符。
|
|
||||||
|
|
||||||
如何從 telegram api 獲取唯一標識符:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl https://api.telegram.org/bot<token>/getUpdates
|
|
||||||
```
|
|
||||||
|
|
||||||
查看結果:(獲取聊天 ID,如 `65382999`)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"ok": true,
|
|
||||||
"result": [
|
|
||||||
{
|
|
||||||
"update_id": 664568113,
|
|
||||||
"message": {
|
|
||||||
"message_id": 8423,
|
|
||||||
"from": {
|
|
||||||
"id": 65382999,
|
|
||||||
"is_bot": false,
|
|
||||||
"first_name": "Bo-Yi",
|
|
||||||
"last_name": "Wu (appleboy)",
|
|
||||||
"username": "appleboy46",
|
|
||||||
"language_code": "en"
|
|
||||||
},
|
|
||||||
"chat": {
|
|
||||||
"id": 65382999,
|
|
||||||
"first_name": "Bo-Yi",
|
|
||||||
"last_name": "Wu (appleboy)",
|
|
||||||
"username": "appleboy46",
|
|
||||||
"type": "private"
|
|
||||||
},
|
|
||||||
"date": 1550333434,
|
|
||||||
"text": "?"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## 模板變數
|
|
||||||
|
|
||||||
| Github 變數 | Telegram 模板變數 |
|
|
||||||
| ----------------- | ----------------- |
|
|
||||||
| 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 |
|
|
||||||
-47
@@ -1,47 +0,0 @@
|
|||||||
name: 'Telegram Message Notify'
|
|
||||||
description: 'Sending a Telegram message'
|
|
||||||
author: 'Bo-Yi Wu'
|
|
||||||
inputs:
|
|
||||||
to:
|
|
||||||
description: 'telegram user'
|
|
||||||
token:
|
|
||||||
description: 'telegram token'
|
|
||||||
message:
|
|
||||||
description: 'telegram message'
|
|
||||||
message_file:
|
|
||||||
description: 'overwrite the default message template with the contents of the specified file'
|
|
||||||
socks5:
|
|
||||||
description: 'support socks5 proxy URL'
|
|
||||||
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'
|
|
||||||
disable_web_page_preview:
|
|
||||||
description: 'disables link previews for links in this message'
|
|
||||||
disable_notification:
|
|
||||||
description: 'disables notifications for this message, supports sending a message without notification,'
|
|
||||||
message_thread_id:
|
|
||||||
description: 'unique identifier for the target message thread (topic) of the forum; for forum supergroups only'
|
|
||||||
runs:
|
|
||||||
using: 'docker'
|
|
||||||
image: 'Dockerfile'
|
|
||||||
|
|
||||||
branding:
|
|
||||||
icon: 'message-square'
|
|
||||||
color: 'blue'
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
Sample message loaded from file.
|
|
||||||
|
|
||||||
Commit msg: {{commit.message}}
|
|
||||||
Reference in New Issue
Block a user