TG推送 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TG推送 | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'addressesapi.txt' | |
workflow_dispatch: # 手动触发 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 加载当前的 GitHub 库 | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: 读取文件内容 | |
id: read_file | |
run: | | |
file_content=$(cat addressesapi.txt) | |
echo "::set-output name=file_content::${file_content}" | |
- name: Get Beijing Time | |
id: time | |
run: | | |
TIME_ZONE="Asia/Shanghai" | |
CURRENT_TIME=$(TZ=${TIME_ZONE} date +"%Y-%m-%d %H:%M:%S") | |
echo "::set-output name=current_time::${CURRENT_TIME}" | |
- name: 执行推送 | |
run: | | |
message="For: ${{ steps.time.outputs.current_time }} | |
${{ steps.read_file.outputs.file_content }}" | |
wget -qO- "https://api.telegram.org/bot${{ secrets.TG_BOT_TOKEN }}/sendMessage?chat_id=${{ secrets.TG_TESTPD_ID }}&text=$message" |