mirror of
https://github.com/appleboy/telegram-action.git
synced 2026-10-09 04:30:43 +09:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd9f2d9fa7 | ||
|
|
4023d256c8 | ||
|
|
214f06cfa3 | ||
|
|
2608c6db39 | ||
|
|
c078210187 | ||
|
|
7f612b977e | ||
|
|
c18c95644a | ||
|
|
6753faf1d2 | ||
|
|
53d62f6c74 | ||
|
|
e9e9d8fda7 | ||
|
|
16657635b3 | ||
|
|
fd541f19b0 | ||
|
|
f8121d9e5a | ||
|
|
b8da483c2e | ||
|
|
724a55ccf8 | ||
|
|
8223320a4c | ||
|
|
ea12760348 | ||
|
|
d678193671 | ||
|
|
d600df785a | ||
|
|
78e5f2ccac | ||
|
|
78c9ef35ff | ||
|
|
4cd2253b24 | ||
|
|
37056891d4 | ||
|
|
847a2d3240 | ||
|
|
1b2bf60368 | ||
|
|
95f03551fd | ||
|
|
85afa0fd9a | ||
|
|
84183da9cf | ||
|
|
5010c012e9 | ||
|
|
94584eda62 | ||
|
|
221e6b6849 | ||
|
|
9177cafddc | ||
|
|
65a1d3c2f9 | ||
|
|
a77dd3e42f | ||
|
|
2e9996f96e | ||
|
|
2efd23283a | ||
|
|
a5d86cddbc | ||
|
|
f384cb685b | ||
|
|
ed144893ba | ||
|
|
beaf02496b | ||
|
|
6ecbcc43b0 | ||
|
|
dc870f34e9 | ||
|
|
6cdf58fd81 | ||
|
|
1ecd8d50e4 | ||
|
|
9e5e0be372 | ||
|
|
0e7bbc5ef7 | ||
|
|
3295af7b78 | ||
|
|
12a87fd2ec | ||
|
|
ec18563cbb | ||
|
|
d23549b68a | ||
|
|
18c4142dfa | ||
|
|
c05923bdec | ||
|
|
50dd6d184f | ||
|
|
68616a84f7 | ||
|
|
f501e27814 | ||
|
|
867844f8a4 | ||
|
|
abd0142ad9 | ||
|
|
363157132e | ||
|
|
d0bf9f621b | ||
|
|
1ac4b1171b |
@@ -0,0 +1,15 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
commit-message:
|
||||||
|
prefix: "chore(ci)"
|
||||||
|
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
commit-message:
|
||||||
|
prefix: "chore(docker)"
|
||||||
+111
-54
@@ -1,69 +1,126 @@
|
|||||||
name: telegram message
|
name: telegram message
|
||||||
on: [push]
|
on: [push]
|
||||||
jobs:
|
jobs:
|
||||||
|
# Tests the working-tree Dockerfile and entrypoint.sh; the build job below
|
||||||
|
# runs against the published image referenced by action.yml instead.
|
||||||
|
local-image:
|
||||||
|
name: Test local image build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: build image from working tree
|
||||||
|
run: docker build -t telegram-action:local .
|
||||||
|
|
||||||
|
- name: send message via local image
|
||||||
|
env:
|
||||||
|
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
run: |
|
||||||
|
docker run --rm \
|
||||||
|
-e INPUT_TO="$TELEGRAM_TO" \
|
||||||
|
-e INPUT_TOKEN="$TELEGRAM_TOKEN" \
|
||||||
|
-e INPUT_MESSAGE_THREAD_ID= \
|
||||||
|
-e INPUT_MESSAGE="ci: local image smoke test for ${{ github.sha }}" \
|
||||||
|
telegram-action:local
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@v7
|
||||||
- name: send custom message with args
|
- name: send message using with
|
||||||
uses: appleboy/telegram-action@master
|
uses: ./
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
args: The ${{ github.event_name }} event triggered first step.
|
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 message useing with
|
- name: send default message
|
||||||
uses: appleboy/telegram-action@master
|
uses: ./
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
message: The ${{ github.event_name }} event triggered second step.
|
|
||||||
|
|
||||||
- name: send default message
|
- name: send photo message
|
||||||
uses: appleboy/telegram-action@master
|
uses: ./
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
message: send photo message
|
||||||
|
photo: "./tests/github.png"
|
||||||
|
document: "./tests/gophercolor.png"
|
||||||
|
|
||||||
- name: send photo message
|
- name: send location message
|
||||||
uses: appleboy/telegram-action@master
|
uses: ./
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
message: send photo message
|
location: "24.9163213 121.1424972"
|
||||||
photo: './tests/github.png'
|
venue: "35.661777 139.704051 竹北體育館 新竹縣竹北市"
|
||||||
document: './tests/gophercolor.png'
|
|
||||||
|
|
||||||
- name: send location message
|
- name: send custom message
|
||||||
uses: appleboy/telegram-action@master
|
uses: ./
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
location: '24.9163213 121.1424972'
|
message: |
|
||||||
venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
|
The ${{ github.event_name }} event triggered final step.
|
||||||
|
echo This event is a pull request that had an assignee removed.
|
||||||
|
|
||||||
- name: send custom message
|
- name: send message file
|
||||||
uses: appleboy/telegram-action@master
|
uses: ./
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
message: |
|
message_file: tests/message.txt
|
||||||
The ${{ github.event_name }} event triggered final step.
|
|
||||||
echo This event is a pull request that had an assignee removed.
|
|
||||||
|
|
||||||
- name: send message file
|
# - name: send message using socks5 proxy URL
|
||||||
uses: appleboy/telegram-action@master
|
# uses: appleboy/telegram-action@master
|
||||||
with:
|
# with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
# to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
# token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
message_file: tests/message.txt
|
# socks5: "http://222.124.154.19:23500"
|
||||||
|
# message: Send message from socks5 proxy URL.
|
||||||
|
|
||||||
- name: send message using socks5 proxy URL
|
# - name: try multiple message
|
||||||
uses: appleboy/telegram-action@master
|
# uses: appleboy/telegram-action@master
|
||||||
with:
|
# with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
# to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
# token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
socks5: "http://222.124.154.19:23500"
|
# format: html
|
||||||
message: Send message from socks5 proxy URL.
|
# 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
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
name: Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
# full semver only; the floating major tag (v1) must not trigger builds
|
||||||
|
- "v[0-9]*.[0-9]*.[0-9]*"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: docker-meta
|
||||||
|
uses: docker/metadata-action@v6
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
ghcr.io/${{ github.repository }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.docker-meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.docker-meta.outputs.labels }}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
name: Goreleaser
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
# full semver only; the floating major tag (v1) must not cut a release
|
||||||
|
- "v[0-9]*.[0-9]*.[0-9]*"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
goreleaser:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- 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 }}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
name: Trivy Security Scan
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# Run at 00:00 on day 1 of every 3rd month (January, April, July, October)
|
||||||
|
- cron: "0 0 1 */3 *"
|
||||||
|
workflow_dispatch: # Allow manual trigger
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
security-events: write # For uploading results to GitHub Security tab
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trivy-scan:
|
||||||
|
name: Trivy Security Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: Run Trivy vulnerability scanner in repo mode
|
||||||
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
|
with:
|
||||||
|
scan-type: "fs"
|
||||||
|
scan-ref: "."
|
||||||
|
format: "sarif"
|
||||||
|
output: "trivy-results.sarif"
|
||||||
|
severity: "CRITICAL,HIGH"
|
||||||
|
|
||||||
|
- name: Upload Trivy results to GitHub Security tab
|
||||||
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
sarif_file: "trivy-results.sarif"
|
||||||
|
|
||||||
|
- name: Run Trivy vulnerability scanner (table output)
|
||||||
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
|
with:
|
||||||
|
scan-type: "fs"
|
||||||
|
scan-ref: "."
|
||||||
|
format: "table"
|
||||||
|
severity: "CRITICAL,HIGH"
|
||||||
|
exit-code: "1"
|
||||||
|
|
||||||
|
trivy-docker:
|
||||||
|
name: Trivy Docker Image Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: docker build -t telegram-action:latest .
|
||||||
|
|
||||||
|
- name: Run Trivy vulnerability scanner on Docker image
|
||||||
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
|
with:
|
||||||
|
scan-type: "image"
|
||||||
|
image-ref: "telegram-action:latest"
|
||||||
|
format: "sarif"
|
||||||
|
output: "trivy-docker-results.sarif"
|
||||||
|
severity: "CRITICAL,HIGH"
|
||||||
|
|
||||||
|
- name: Upload Trivy Docker results to GitHub Security tab
|
||||||
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
sarif_file: "trivy-docker-results.sarif"
|
||||||
|
|
||||||
|
# Gated at CRITICAL only: base images may carry upstream HIGHs that can
|
||||||
|
# only be cleared by an upstream rebuild. They remain visible in the
|
||||||
|
# Security tab via the SARIF upload above.
|
||||||
|
- name: Run Trivy vulnerability scanner on Docker image (table output)
|
||||||
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
scan-type: "image"
|
||||||
|
image-ref: "telegram-action:latest"
|
||||||
|
format: "table"
|
||||||
|
severity: "CRITICAL"
|
||||||
|
exit-code: "1"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.DS_Store
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
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
|
||||||
+2
-3
@@ -1,7 +1,6 @@
|
|||||||
FROM appleboy/drone-telegram:1.3.5-linux-amd64
|
FROM ghcr.io/appleboy/drone-telegram:1.5.1
|
||||||
|
|
||||||
ADD entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
|
||||||
|
|
||||||
WORKDIR /github/workspace
|
WORKDIR /github/workspace
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# 🚀 Telegram for GitHub Actions
|
# 🚀 Telegram for GitHub Actions
|
||||||
|
|
||||||
[GitHub Action](https://github.com/features/actions) for sending a Telegram notification message.
|
[繁體中文](./README.zh-tw.md) | [简体中文](./README.zh-cn.md)
|
||||||
|
|
||||||
|
[GitHub Action](https://github.com/features/actions) for sending Telegram notification messages.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -8,7 +10,9 @@
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Send custom message and see the custom variable as blow.
|
**Note**: If you receive the "Error: Chat not found" error, please refer to this StackOverflow answer [here](https://stackoverflow.com/a/41291666).
|
||||||
|
|
||||||
|
Send a custom message and view the custom variables below.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
name: telegram message
|
name: telegram message
|
||||||
@@ -19,20 +23,25 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- name: send telegram message on push
|
||||||
- name: send custom message with args
|
uses: appleboy/telegram-action@v1
|
||||||
uses: appleboy/telegram-action@master
|
with:
|
||||||
with:
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
message: |
|
||||||
args: The ${{ github.event_name }} event triggered first step.
|
${{ 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 the `message` input to send the default message.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
- name: send default message
|
- name: send default message
|
||||||
uses: appleboy/telegram-action@master
|
uses: appleboy/telegram-action@v1
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
@@ -42,27 +51,35 @@ Remove `args` to send the default message.
|
|||||||
|
|
||||||
## Input variables
|
## Input variables
|
||||||
|
|
||||||
* socks5 - optional. support socks5 proxy URL
|
| Variable | Description |
|
||||||
* photo - optional. photo message
|
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
||||||
* document - optional. document message
|
| to | **required**. Unique identifier for the target chat. |
|
||||||
* sticker - optional. sticker message
|
| token | **required**. Telegram authorization token. |
|
||||||
* audio - optional. audio message
|
| socks5 | optional. Support socks5 proxy URL |
|
||||||
* voice - optional. voice message
|
| photo | optional. Photo message |
|
||||||
* location - optional. location message
|
| document | optional. Document message |
|
||||||
* venue - optional. venue message
|
| sticker | optional. Sticker message |
|
||||||
* video - optional. video message
|
| audio | optional. Audio message |
|
||||||
* debug - optional. enable debug mode
|
| voice | optional. Voice message |
|
||||||
* format - optional. `markdown` or `html`
|
| location | optional. Location message |
|
||||||
* message_file - optional. overwrite the default message template with the contents of the specified file.
|
| 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:
|
Send photo message:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@v7
|
||||||
- name: send photo message
|
- name: send photo message
|
||||||
uses: appleboy/telegram-action@master
|
uses: appleboy/telegram-action@v1
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
@@ -71,11 +88,11 @@ send photo message:
|
|||||||
document: tests/gophercolor.png
|
document: tests/gophercolor.png
|
||||||
```
|
```
|
||||||
|
|
||||||
send location message:
|
Send location message:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
- name: send location message
|
- name: send location message
|
||||||
uses: appleboy/telegram-action@master
|
uses: appleboy/telegram-action@v1
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
@@ -83,24 +100,23 @@ send location message:
|
|||||||
venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
|
venue: '35.661777 139.704051 竹北體育館 新竹縣竹北市'
|
||||||
```
|
```
|
||||||
|
|
||||||
send custom message:
|
Send a message to a specific forum topic (thread):
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
- name: send custom message
|
- name: send message to forum topic
|
||||||
uses: appleboy/telegram-action@master
|
uses: appleboy/telegram-action@v1
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
message: |
|
message_thread_id: 42
|
||||||
The ${{ github.event_name }} event triggered final step.
|
message: Hello from GitHub Actions!
|
||||||
echo This event is a pull request that had an assignee removed.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
send message using custom proxy (support `http`, `https`, and `socks5`)
|
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
|
```yml
|
||||||
- name: send message using socks5 proxy URL
|
- name: send message using socks5 proxy URL
|
||||||
uses: appleboy/telegram-action@master
|
uses: appleboy/telegram-action@v1
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
@@ -157,7 +173,7 @@ See the result: (get chat id like `65382999`)
|
|||||||
## Template variable
|
## Template variable
|
||||||
|
|
||||||
| Github Variable | Telegram Template Variable |
|
| Github Variable | Telegram Template Variable |
|
||||||
|-------------------|----------------------------|
|
| ----------------- | -------------------------- |
|
||||||
| GITHUB_REPOSITORY | repo |
|
| GITHUB_REPOSITORY | repo |
|
||||||
| GITHUB_ACTOR | repo.namespace |
|
| GITHUB_ACTOR | repo.namespace |
|
||||||
| GITHUB_SHA | commit.sha |
|
| GITHUB_SHA | commit.sha |
|
||||||
|
|||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
# 🚀 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)。
|
||||||
|
|
||||||
|
发送自定义消息并查看如下的自定义变量。
|
||||||
|
|
||||||
|
## 输入变量
|
||||||
|
|
||||||
|
| 变量 | 描述 |
|
||||||
|
| ------------------------ | ------------------------------------------------------------------------------------------------------- |
|
||||||
|
| to | **必填**。目标聊天的唯一标识符 |
|
||||||
|
| token | **必填**。Telegram 授权令牌 |
|
||||||
|
| 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 | 可选。用指定文件的内容覆盖默认消息模板。 |
|
||||||
|
| message_thread_id | 可选。论坛目标消息串(主题)的唯一标识符,仅适用于论坛超级群组。 |
|
||||||
|
| disable_web_page_preview | 可选。禁用此消息中链接的预览。默认值为 `false`。 |
|
||||||
|
| disable_notification | 可选。禁用此消息的通知,支持发送无通知的消息。默认值为 `false`。 |
|
||||||
|
|
||||||
|
## 示例
|
||||||
|
|
||||||
|
发送照片消息:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
- name: send photo message
|
||||||
|
uses: appleboy/telegram-action@v1
|
||||||
|
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@v1
|
||||||
|
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@v1
|
||||||
|
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 |
|
||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
# 🚀 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)。
|
||||||
|
|
||||||
|
發送自訂訊息並參考以下自訂變數。
|
||||||
|
|
||||||
|
## 輸入變數
|
||||||
|
|
||||||
|
| 變數 | 說明 |
|
||||||
|
| ------------------------ | ------------------------------------------------------------------------------------------------------- |
|
||||||
|
| to | **必填**。目標聊天的唯一標識符 |
|
||||||
|
| token | **必填**。Telegram 授權令牌 |
|
||||||
|
| 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 | 選填。使用指定檔案的內容覆蓋預設訊息模板 |
|
||||||
|
| message_thread_id | 選填。論壇目標訊息串(主題)的唯一標識符,僅適用於論壇超級群組 |
|
||||||
|
| disable_web_page_preview | 選填。停用此訊息中連結的預覽。預設為 `false` |
|
||||||
|
| disable_notification | 選填。停用此訊息的通知,支援發送無通知的訊息。預設為 `false` |
|
||||||
|
|
||||||
|
## 範例
|
||||||
|
|
||||||
|
發送圖片訊息:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
- name: send photo message
|
||||||
|
uses: appleboy/telegram-action@v1
|
||||||
|
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@v1
|
||||||
|
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@v1
|
||||||
|
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 |
|
||||||
+9
-1
@@ -4,8 +4,10 @@ author: 'Bo-Yi Wu'
|
|||||||
inputs:
|
inputs:
|
||||||
to:
|
to:
|
||||||
description: 'telegram user'
|
description: 'telegram user'
|
||||||
|
required: true
|
||||||
token:
|
token:
|
||||||
description: 'telegram token'
|
description: 'telegram token'
|
||||||
|
required: true
|
||||||
message:
|
message:
|
||||||
description: 'telegram message'
|
description: 'telegram message'
|
||||||
message_file:
|
message_file:
|
||||||
@@ -32,9 +34,15 @@ inputs:
|
|||||||
description: 'enable debug mode.'
|
description: 'enable debug mode.'
|
||||||
format:
|
format:
|
||||||
description: 'message format: markdown or html'
|
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:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'docker://ghcr.io/appleboy/telegram-action:1.1.1'
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: 'message-square'
|
icon: 'message-square'
|
||||||
|
|||||||
@@ -4,6 +4,4 @@ set -eu
|
|||||||
|
|
||||||
export GITHUB="true"
|
export GITHUB="true"
|
||||||
|
|
||||||
[ -n "$*" ] && export TELEGRAM_MESSAGE="$*"
|
|
||||||
|
|
||||||
/bin/drone-telegram
|
/bin/drone-telegram
|
||||||
|
|||||||
Reference in New Issue
Block a user