-
-
Notifications
You must be signed in to change notification settings - Fork 160
59 lines (56 loc) · 2.25 KB
/
index.yml
File metadata and controls
59 lines (56 loc) · 2.25 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
name: Update gamecache.sqlite.gz with BGG data
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
jobs:
index:
runs-on: ubuntu-latest
permissions:
contents: write # needed to create/update releases
steps:
- name: Check enabled (secret present?)
id: enabled
env:
GAMECACHE_GITHUB_TOKEN: ${{ secrets.GAMECACHE_GITHUB_TOKEN }}
MYBGG_GITHUB_TOKEN: ${{ secrets.MYBGG_GITHUB_TOKEN }}
GAMECACHE_BGG_TOKEN: ${{ secrets.GAMECACHE_BGG_TOKEN }}
run: |
if [ -n "$GAMECACHE_GITHUB_TOKEN" ] || [ -n "$MYBGG_GITHUB_TOKEN" ]; then
echo "enabled=true" >> $GITHUB_OUTPUT
if [ -z "$GAMECACHE_GITHUB_TOKEN" ] && [ -n "$MYBGG_GITHUB_TOKEN" ]; then
echo "::warning::Using deprecated MYBGG_GITHUB_TOKEN (rename to GAMECACHE_GITHUB_TOKEN)." >&2
else
echo "Hourly updates enabled." >&2
fi
else
echo "enabled=false" >> $GITHUB_OUTPUT
echo "::notice::GAMECACHE_GITHUB_TOKEN not set; skipping run." >&2
fi
# Check for BGG token
if [ -z "$GAMECACHE_BGG_TOKEN" ]; then
echo "::warning::GAMECACHE_BGG_TOKEN not set; BGG authentication may fail." >&2
fi
- name: Checkout
if: steps.enabled.outputs.enabled == 'true'
uses: actions/checkout@v4
- name: Setup Python
if: steps.enabled.outputs.enabled == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Build & index (auto-skip if not enabled)
if: steps.enabled.outputs.enabled == 'true'
env:
GAMECACHE_GITHUB_TOKEN: ${{ secrets.GAMECACHE_GITHUB_TOKEN }}
MYBGG_GITHUB_TOKEN: ${{ secrets.MYBGG_GITHUB_TOKEN }}
GAMECACHE_BGG_TOKEN: ${{ secrets.GAMECACHE_BGG_TOKEN }}
run: |
# Fallback: promote legacy token if new one absent
if [ -z "$GAMECACHE_GITHUB_TOKEN" ] && [ -n "$MYBGG_GITHUB_TOKEN" ]; then
export GAMECACHE_GITHUB_TOKEN="$MYBGG_GITHUB_TOKEN"
fi
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
python scripts/download_and_index.py --debug