Files
tvbox-json-monitor/.github/workflows/tvbox-json-monitor.yml
T
dependabot[bot] c7626da50e deps(deps): bump actions/checkout in the github-actions group (#2)
Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 6 to 7
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 00:10:59 +00:00

90 lines
2.4 KiB
YAML

name: Monitor TVBox JSON
on:
schedule:
# Run every 12 hours at 00:00 and 12:00 UTC.
- cron: "0 */12 * * *"
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@v7
- 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
id: extract
run: |
set +e
python3 scripts/extract_tvbox.py
status="$?"
set -e
if [ "${status}" -eq 0 ]; then
echo "upstream_error=false" >> "${GITHUB_OUTPUT}"
exit 0
fi
if [ "${status}" -eq 75 ]; then
echo "upstream_error=true" >> "${GITHUB_OUTPUT}"
exit 0
fi
exit "${status}"
- name: Report skipped upstream update
if: ${{ steps.extract.outputs.upstream_error == 'true' }}
run: |
{
echo "### TVBox update skipped"
echo
echo "The upstream endpoint could not be fetched or decoded during this run."
echo "Existing generated files were left unchanged."
} >> "${GITHUB_STEP_SUMMARY}"
- name: Validate generated files
if: ${{ steps.extract.outputs.upstream_error == 'false' }}
run: |
python3 -m json.tool "${OUT_JSON}" > /dev/null
python3 -m json.tool "${OUT_META}" > /dev/null
- name: Commit and push changes
if: ${{ steps.extract.outputs.upstream_error == 'false' }}
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