Files
2025-10-09 21:48:18 +08:00

60 lines
1.6 KiB
YAML

name: Check dlgt7/TVbox-interface Fork Updates
on:
schedule:
- cron: '0 * * * *' # 每小时运行一次
workflow_dispatch: # 支持手动触发
jobs:
check-forks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: pip install requests PyGithub
- name: Run Fork Update Checker
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python <<EOF
import requests
from github import Github
import os
owner = "dlgt7"
repo = "TVbox-interface"
token = os.environ["GH_TOKEN"]
g = Github(token)
# 获取原始仓库最新 commit
origin_repo = g.get_repo(f"{owner}/{repo}")
origin_commit = origin_repo.get_commits()[0].sha
# 获取所有 fork
forks = origin_repo.get_forks()
print(f"Found {forks.totalCount} forks.")
updated_forks = []
for fork in forks:
try:
fork_commit = fork.get_commits()[0].sha
if fork_commit != origin_commit:
updated_forks.append(f"{fork.full_name} ({fork_commit})")
except Exception as e:
print(f"Error checking {fork.full_name}: {e}")
print("=== Updated Forks ===")
for uf in updated_forks:
print(uf)
# 可以在此生成 issue 或 artifact,如果需要的话
EOF