Files
tvbox_collect/leexuben/.github/workflows/main.yml
T
2026-06-29 03:41:14 +00:00

44 lines
1.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Update TV.json
on:
schedule:
- cron: '0 2 * * *' # 每天凌晨2点UTC时间运行
push:
branches:
- main
workflow_dispatch: # 允许手动触发
permissions:
contents: write # ❗ 必须改为 write,否则无法推送
jobs:
update-tv-json: # ❗ 建议用短横线命名更规范
runs-on: ubuntu-latest
steps:
- name: 检出仓库代码
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
fetch-depth: 0 # 获取完整历史记录
- name: 设置 Python 环境
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: 安装依赖
run: |
python -m pip install --upgrade pip
pip install requests
- name: 运行 Python 脚本(包含 GitHub 推送)
env:
# ❗ 关键:直接使用 GitHub 提供的环境变量
GIT_REMOTE_URL: https://x-access-token:${{ secrets.MY_GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
GIT_BRANCH: ${{ github.ref_name }} # 推送到当前分支
GIT_COMMIT_MESSAGE: "🔄 自动更新 TV.json(站点 & Live"
run: |
echo "开始执行合并脚本(包含 GitHub 推送功能)..."
python merge_sites.py