purge history

This commit is contained in:
GitHub Actions
2026-02-07 05:02:33 +00:00
commit d0bd20ce39
686 changed files with 294875 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
name: Clean up the garbage
on:
schedule:
- cron: '0 4 7 * *'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout target repo
uses: actions/checkout@v6
with:
repository: cluntop/tvbox
token: ${{ secrets.GIT_TOKEN }}
fetch-depth: 1
- name: Install git-filter-repo
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
pip3 install git-filter-repo
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
- name: Compressing
run: |
git prune-packed
git reflog expire --expire=now --all
git gc --prune=now --aggressive
- name: Force Push Changes
run: |
git push origin --force --all
git push origin --force --tags
- name: Reset History
run: |
git checkout --orphan latest_branch
git add -A
git commit -m "purge history"
git branch -D main
git branch -m main
- name: Force Push to Remote
run: |
git push -f origin main
+16
View File
@@ -0,0 +1,16 @@
name: Greetings
on: [pull_request_target, issues]
jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Message that will be displayed on users' first issue"
pr-message: "Message that will be displayed on users' first pull request"
+53
View File
@@ -0,0 +1,53 @@
name: Auto Update JS MD5
on:
# 监听代码推送
push:
# 只有当 .js 文件发生变化时才触发,避免无意义运行
paths:
- '**.js'
- '.github/workflows/md5.yml' # 方便调试脚本本身
permissions:
contents: write
jobs:
generate-md5:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0 # 获取完整历史,方便提交
- name: 🧮 Calculate & Update MD5
run: |
echo "开始扫描所有 .js 文件..."
find . -type f -name "*.js" -not -path '*/.git/*' | while read -r file; do
current_md5=$(md5sum "$file" | awk '{print $1}')
target_file="${file}.md5"
echo "$current_md5" > "$target_file"
echo "✅ 已更新: $target_file -> $current_md5"
done
- name: 📤 Commit & Push Changes
run: |
# 配置机器人身份
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add **/*.js.md5
if ! git diff-index --quiet HEAD; then
git commit -m "Update md5"
git push
echo "::notice::🚀 MD5 文件已更新并推送!"
else
echo "::notice::⚠️ MD5 值没有变化,跳过提交。"
fi
+99
View File
@@ -0,0 +1,99 @@
# Simple workflow for deploying static content to GitHub Pages
name: Update Deploy to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
DEPLOY_REF: ${{ github.event.inputs.deploy_branch || github.ref }}
UPLOAD_PATH: "."
TZ: Asia/Shanghai
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
repository: cluntop/tvbox
token: ${{ secrets.GIT_TOKEN }}
fetch-depth: 1
lfs: true
- name: 🔄 Auto Commit Timestamp
if: github.event_name == 'schedule'
run: |
cd ${{ env.UPLOAD_PATH }}
echo "Last deployment run at: $(date)" > last_run.txt
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add last_run.txt
if ! git diff-index --quiet HEAD; then
git commit -m "🤖 Auto-update: Scheduled deployment [skip ci]"
git push
echo "::notice::✅ 已自动提交更新时间戳"
else
echo "::notice::⚠️ 无文件变更,跳过提交"
fi
- name: Verify & Generate CNAME
run: |
echo "clun.top" > ${{ env.UPLOAD_PATH }}/CNAME
FILE_COUNT=$(find ${{ env.UPLOAD_PATH }} -type f | wc -l)
SIZE=$(du -sh ${{ env.UPLOAD_PATH }} | cut -f1)
echo "### 📦 部署准备就绪" >> $GITHUB_STEP_SUMMARY
echo "- **分支**: \`${{ env.DEPLOY_REF }}\`" >> $GITHUB_STEP_SUMMARY
echo "- **文件数量**: $FILE_COUNT" >> $GITHUB_STEP_SUMMARY
echo "- **总大小**: $SIZE" >> $GITHUB_STEP_SUMMARY
if [ "$FILE_COUNT" -eq 0 ]; then
echo "::error::❌ 目录下没有文件,终止部署!"
exit 1
fi
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
# Upload entire repository
path: ${{ env.UPLOAD_PATH }}
retention-days: 1
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Deployment Success Info
if: success()
run: |
echo "::notice title=部署成功::✅ 您的站点已上线!"
echo "### 🚀 部署成功!" >> $GITHUB_STEP_SUMMARY
echo "访问地址: [${{ steps.deployment.outputs.page_url }}](${{ steps.deployment.outputs.page_url }})" >> $GITHUB_STEP_SUMMARY
+38
View File
@@ -0,0 +1,38 @@
name: Summarize new issues
on:
issues:
types: [opened]
jobs:
summary:
runs-on: ubuntu-latest
permissions:
issues: write
models: read
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
repository: cluntop/tvbox
token: ${{ secrets.GIT_TOKEN }}
fetch-depth: 1
- name: Run AI inference
id: inference
uses: actions/ai-inference@v2
with:
prompt: |
Summarize the following GitHub issue in one paragraph:
Title: ${{ github.event.issue.title }}
Body: ${{ github.event.issue.body }}
- name: Comment with AI summary
run: |
gh issue comment $ISSUE_NUMBER --body '${{ steps.inference.outputs.response }}'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
RESPONSE: ${{ steps.inference.outputs.response }}
+79
View File
@@ -0,0 +1,79 @@
name: Upstream Sync
permissions:
contents: write
actions: write
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
inputs:
upstream_branch:
description: "上游仓库分支"
required: true
default: "main"
type: string
target_branch:
description: "目标仓库分支"
required: true
default: "main"
type: string
sync_strategy:
description: "同步策略"
required: true
default: "discard"
type: choice
options:
- discard # 强制同步:丢弃本地修改,完全复制上游 (推荐)
- merge # 尝试合并:如果有冲突会报错
env:
UPSTREAM_REPO: "cluntop/tvbox"
UPSTREAM_BRANCH: ${{ github.event.inputs.upstream_branch || 'main' }}
TARGET_BRANCH: ${{ github.event.inputs.target_branch || 'main' }}
SYNC_STRATEGY: ${{ github.event.inputs.sync_strategy || 'discard' }}
jobs:
sync_upstream:
name: Sync and Notify
runs-on: ubuntu-latest
if: ${{ github.event.repository.fork }}
steps:
- name: Checkout Target Repo
uses: actions/checkout@v6
with:
ref: ${{ env.TARGET_BRANCH }}
repository: cluntop/tvbox
token: ${{ secrets.GIT_TOKEN }}
persist-credentials: true
fetch-depth: 1
- name: Sync Upstream Changes
id: sync
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4.1
with:
upstream_sync_repo: ${{ env.UPSTREAM_REPO }}
upstream_sync_branch: ${{ env.UPSTREAM_BRANCH }}
target_sync_branch: ${{ env.TARGET_BRANCH }}
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
upstream_pull_args: ${{ env.SYNC_STRATEGY == 'discard' && '--allow-unrelated-histories --force' || '' }}
target_branch_push_args: ${{ env.SYNC_STRATEGY == 'discard' && '--force' || '' }}
test_mode: false
- name: Generate Summary
run: |
echo "### 🔄 同步报告 (Sync Report)" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Value |" >> $GITHUB_STEP_SUMMARY
echo "| :--- | :--- |" >> $GITHUB_STEP_SUMMARY
echo "| **源仓库** | [${{ env.UPSTREAM_REPO }}](https://github.com/${{ env.UPSTREAM_REPO }}) |" >> $GITHUB_STEP_SUMMARY
echo "| **结果** | ${{ steps.sync.outputs.sync_status == 'success' && '✅ 成功 (Success)' || '❌ 失败 (Failed)' }} |" >> $GITHUB_STEP_SUMMARY
- name: Delete Old Workflows
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 3
+70
View File
@@ -0,0 +1,70 @@
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
+90
View File
@@ -0,0 +1,90 @@
name: Update zip package
permissions:
contents: write
actions: write
on:
schedule:
- cron: '0 * * * *' # 每小时运行一次
workflow_dispatch: # 允许手动触发
env:
TZ: Asia/Shanghai # 设置时区
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Delete old records
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 5
- name: Checkout target repo
uses: actions/checkout@v6
with:
repository: cluntop/tvbox
token: ${{ secrets.GIT_TOKEN }}
path: target-repo
fetch-depth: 1
- name: Process Xiaosa resource
run: |
echo "Starting Xiaosa download..."
mkdir -p temp_xiaosa
cd temp_xiaosa
wget --tries=3 --timeout=30 https://github.com/PizazzGY/NewTVBox/raw/main/%E5%8D%95%E7%BA%BF%E8%B7%AF.zip -O xiaosa.zip
unzip -q xiaosa.zip
mkdir -p ../target-repo/js/xiaosa
if [ -d "TVBoxOSC/tvbox" ]; then
cp -rf TVBoxOSC/tvbox/* ../target-repo/js/xiaosa/
echo "Xiaosa files copied successfully."
else
echo "Error: Xiaosa source directory structure changed."
ls -R
fi
cd ..
rm -rf temp_xiaosa
- name: Process Source Repo
run: |
git clone --depth 1 https://github.com/fish2018/PG.git source-repo
cd source-repo
ZIP_FILE=$(find . -type f -name "pg.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9].zip" | sort -r | head -n 1)
if [ -z "$ZIP_FILE" ]; then
echo "Warning: No matching zip file found in Source Repo."
else
echo "Found zip file: $ZIP_FILE"
unzip -o "$ZIP_FILE" -x "README.txt" -d ../target-repo/
echo "PG zip extracted to target repo."
fi
- name: Commit and push changes
working-directory: target-repo
run: |
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
git add .
if git diff --staged --quiet; then
echo "No changes to commit."
exit 0
else
COMMIT_MSG="Update zip"
git commit -m "$COMMIT_MSG"
git push origin HEAD:main
echo "Changes pushed successfully."
fi