Skip to content

Automate TigerTag JSON database updates - #33

Open
TigerTag-Project wants to merge 1 commit into
suchmememanyskill:mainfrom
TigerTag-Project:tigertag-json-auto-update
Open

TigerTag-Project wants to merge 1 commit into
suchmememanyskill:mainfrom
TigerTag-Project:tigertag-json-auto-update

Conversation

@TigerTag-Project

Copy link
Copy Markdown

Keeping the TigerTag tables in src/tag/tigertag/database/ up to date currently means running download_json.py by hand and opening a PR (as in #17 and #31). This PR automates it.

download_json.py

It now follows the sync strategy described in the TigerTag RFID Guide (section 2.0):

  • Fetches the last_update manifest first, and only downloads the tables whose timestamp changed. The manifest is stored as database/last_update.json.
  • Uses the TigerTag API, and falls back to the GitHub mirror of the guide (synced every 6 hours) if the API is unreachable.
  • Checks each download is a non-empty JSON array before replacing the file, so a failed run never leaves a broken table behind.
  • Writes the tables indented, one entry per line. Today each table is a single line, so every update shows as "1 line changed" and is impossible to review.
  • New options: --force re-downloads every table, and --summary FILE writes a markdown list of added, removed and changed entries.

The parser is unchanged: registry.py reads the same files.

Workflow .github/workflows/update-tigertag-json.yml

  • Runs every Monday at 06:00 UTC, and on demand (workflow_dispatch).
  • Syncs the tables. If something changed, it runs pytest, then opens (or updates) a pull request from the automation/update-tigertag-json branch, with the change summary as the description.
  • Tests run inside this workflow because pull requests opened with GITHUB_TOKEN do not trigger the pytest workflow.

One setting is needed for the workflow to open pull requests: Settings → Actions → General → Workflow permissions → tick "Allow GitHub Actions to create and approve pull requests".

Notes

  • The first run downloads every table, since no last_update.json exists yet, and reformats them. Its PR will therefore also include whatever Update TigerTag JSON database #31 has not merged yet.
  • Tested locally: first run, a second run with nothing to download, and the GitHub fallback with the API unreachable. Tests: 95 passed, 1 skipped.

- download_json.py now follows the sync strategy of the TigerTag RFID
  Guide: fetch the last_update manifest, download only the tables whose
  timestamp changed, use the TigerTag API with the GitHub mirror as
  fallback, and validate each table before replacing it
- Tables are written indented so updates produce readable diffs
- Add --force and --summary options; the summary lists added, removed
  and changed entries per table
- Add a weekly workflow that syncs the tables, runs pytest and opens a
  pull request when something changed
@TigerTag-Project
TigerTag-Project force-pushed the tigertag-json-auto-update branch from 836936a to 9179f35 Compare October 13, 2026 20:34
@TigerTag-Project

TigerTag-Project commented Oct 13, 2026 •

Copy link
Copy Markdown
Author

Hi @suchmememanyskill, we're the TigerTag team. This PR automates the TigerTag JSON database updates, so future updates no longer need manual PRs like #17.

We tested the workflow end-to-end on our fork before submitting it: it synced all 7 tables from the TigerTag API, ran pytest (all green), and opened the update PR by itself, with a readable summary of added and changed brands and materials. See the test run and the PR it opened.

To enable it after merging, one setting is needed: Settings → Actions → General → Workflow permissions → "Allow GitHub Actions to create and approve pull requests". The workflow then runs every Monday at 06:00 UTC, and can also be started by hand from the Actions tab.

Two related PRs are also open:

Happy to adjust anything!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant