name: Update zip permissions: contents: write actions: write pull-requests: write # 'write' access to pull requests 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@v7 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: Submit the changes working-directory: target-repo run: | git config --global user.name "github-actions[bot]" git config --global user.email "41898282+github-actions[bot]@users.noreply.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 git commit -a -m "Update zip" - name: Push changes uses: ad-m/github-push-action@master with: token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ github.ref }} # pull: rebase # pull --rebase before push; also accepts: merge | ff-only | true