Repository navigation
80 lines (72 loc) · 2.19 KB
/
Copy pathsync.yml
File metadata and controls
80 lines (72 loc) · 2.19 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Sync database
on:
workflow_dispatch:
inputs:
allow_shrink:
description: Allow a large dataset shrink
required: false
default: false
type: boolean
schedule:
- cron: '17 2 * * *'
push:
branches: [main]
paths:
- 'scripts/**'
- 'schema/**'
- '.github/workflows/sync.yml'
permissions:
contents: write
concurrency:
group: airwavedb-database-sync
cancel-in-progress: true
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 1
- uses: actions/setup-node@v7
with:
node-version: '22'
- name: Build database
run: node scripts/sync.mjs
env:
ALLOW_SHRINK: ${{ inputs.allow_shrink && '1' || '0' }}
- name: Enrich explicit tag classifications
run: node scripts/enrich.mjs
- name: Normalize language codes
run: node scripts/normalize-languages.mjs
- name: Validate database
run: node scripts/validate.mjs
- name: Validate language normalization
run: node scripts/validate-languages.mjs
- name: Commit changes
env:
ALLOW_SHRINK: ${{ inputs.allow_shrink && '1' || '0' }}
run: |
if [ -z "$(git status --porcelain -- data)" ]; then
echo "No data changes"
exit 0
fi
git config user.name "airwavedb-bot"
git config user.email "airwavedb-bot@users.noreply.github.com"
git fetch origin main
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/main)" ]; then
echo "main advanced while building; rebuilding on the latest commit"
git reset --hard origin/main
node scripts/sync.mjs
node scripts/enrich.mjs
node scripts/normalize-languages.mjs
node scripts/validate.mjs
node scripts/validate-languages.mjs
fi
if [ -z "$(git status --porcelain -- data)" ]; then
echo "No data changes after rebuild"
exit 0
fi
git add data
git commit -m "chore(data): sync radio directory"
git push