Repository navigation
65 lines (52 loc) · 2.04 KB
/
Copy pathsync-database.yml
File metadata and controls
65 lines (52 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Sync TigerTag database
on:
schedule:
# Every 6 hours. Adjust the cron if you want a different cadence.
- cron: '0 */6 * * *'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: sync-database
cancel-in-progress: false
env:
# Opt in to Node.js 24 for JavaScript actions ahead of the June 2026
# forced cutover (see github.blog/changelog/2025-09-19-deprecation-of-node-20).
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: pip install --no-cache-dir requests
- name: Run incremental sync
run: python database/db_update.py
- name: Commit and push if changes
run: |
if [[ -z "$(git status --porcelain database/)" ]]; then
echo "No dataset changes — nothing to commit."
exit 0
fi
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add database/
changed=$(git diff --cached --name-only | xargs -n1 basename | paste -sd ', ' -)
git commit -m "Auto-sync database: ${changed}"
git push
# Tell the site the snapshot may have moved, so a new product shows up on
# tigersystem.io within minutes instead of at its next hourly regeneration.
# Safe to call every run: the endpoint asks GitHub itself which commit is
# current and does nothing when the site is already built on it. Never
# fatal — the site also checks on its own every hour, so a missed call
# only costs time.
- name: Tell tigersystem.io to look
if: always()
run: |
curl --silent --show-error --max-time 60 -X POST \
https://tigersystem.io/api/catalog/refresh || echo "Hub not reachable — it will catch up on its hourly check."