Thanks to visit codestin.com
Credit goes to github.com

Skip to content

IPTV Update

IPTV Update #180

Workflow file for this run

name: IPTV Update
on:
schedule:
- cron: '55 0 */2 * *' # 每2天凌晨00点55分执行任务,上海时区的UTC时间
# 允许手动触发工作流
workflow_dispatch:
branches:
- main # 仅在 main 分支上允许手动触发
jobs:
run_script:
runs-on: ubuntu-latest # 使用最新的 Ubuntu 运行器
steps:
- name: Checkout repository # 检出代码库到运行器中
uses: actions/checkout@v2
- name: Set up Python # 设置 Python 环境
uses: actions/setup-python@v2
with:
python-version: '3.10' # 使用 Python 版本 3.10
- name: Cache dependencies # 缓存 pip 依赖项以加速后续构建
uses: actions/cache@v4
with:
path: ~/.cache/pip # 依赖项的缓存路径
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} # 生成缓存键
restore-keys: |
${{ runner.os }}-pip- # 如果完全匹配的 key 不存在,则尝试使用此恢复键
- name: Install dependencies # 安装项目所需的 Python 包
run: |
pip install aiohttp # 安装 aiohttp 库
pip install requests # 安装 requests 库
- name: Run Python script # 执行主脚本
run: python main.py
- name: Commit and push if changed # 如果有更改,则提交并推送
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A # 添加所有更改到暂存区
# 如果有更改被暂存,则创建并推送一个新的提交
if ! git diff --staged --quiet; then
git commit -m "Auto-update live files" # 提交信息
git pull --rebase # 拉取远程更新并变基
git push # 推送更改到远程仓库
fi
env:
TZ: Asia/Shanghai # 设置环境变量,将时区设置为上海