forked from Ikalus1988/MisakaNet
-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (31 loc) 路 928 Bytes
/
Copy pathsync-data.yml
File metadata and controls
34 lines (31 loc) 路 928 Bytes
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
name: Sync Metadata to data Branch
on:
push:
branches: [main]
paths:
- "counter.json"
- "lessons.json"
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Push to data branch
run: |
git config user.name "misakanet-bot"
git config user.email "bot@misakanet.dev"
# Checkout the data branch
git fetch origin data
git checkout data
# Overwrite with current versions from main
git checkout main -- counter.json lessons.json
# Commit if changed
if ! git diff --quiet; then
git add counter.json lessons.json
git commit -m "sync: auto-update metadata from main@$(git rev-parse --short main)"
git push origin data
fi
git checkout main