name: Monitor TVBox JSON on: schedule: # Run every 5 minutes. GitHub-hosted schedules may be delayed under load. - cron: "*/5 * * * *" workflow_dispatch: permissions: contents: write concurrency: group: tvbox-json-monitor cancel-in-progress: false jobs: update-tvbox-json: runs-on: ubuntu-latest env: TVBOX_URL: ${{ vars.TVBOX_URL }} TVBOX_UA: "okhttp/3.15" OUT_JSON: "data/tvbox.json" OUT_META: "data/tvbox.meta.json" steps: - name: Checkout repository uses: actions/checkout@v4 - name: Validate repository variables run: | if [ -z "${TVBOX_URL}" ]; then echo "Repository variable TVBOX_URL is not set." exit 1 fi - name: Extract and decode TVBox JSON run: python3 scripts/extract_tvbox.py - name: Validate generated files run: | python3 -m json.tool "${OUT_JSON}" > /dev/null python3 -m json.tool "${OUT_META}" > /dev/null - name: Commit and push changes run: | if git diff --quiet -- "${OUT_JSON}" "${OUT_META}"; then echo "No TVBox JSON update detected." exit 0 fi git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add "${OUT_JSON}" "${OUT_META}" COMMIT_TIME="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" git commit -m "chore(tvbox): update decoded JSON ${COMMIT_TIME}" git push