fun/.github/workflows/tv_run.yml
2026-01-07 04:36:44 +00:00

70 lines
1.7 KiB
YAML
Executable file

name: Update data m3u
permissions:
contents: write
actions: write
on:
schedule:
- cron: '0,30 * * * *' # 每小时执行一次
workflow_dispatch: # 允许手动触发
env:
TZ: Asia/Shanghai
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Update:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
repository: cluntop/tvbox
token: ${{ secrets.GIT_TOKEN }}
fetch-depth: 1
- name: Delete old workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 3
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f .github/requirements.txt ]; then pip install -r .github/requirements.txt; fi
pip install pandas requests
- name: Run IPTV script
run: |
python py/get_iptv.py
- name: Commit and Push changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
if [ -n "$(git status --porcelain)" ]; then
echo "Changes detected, committing..."
git add .
git commit -m "Update m3u"
git pull --rebase origin main
git push origin main
else
echo "No changes detected, skipping push."
fi