forked from Ikalus1988/MisakaNet
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) 路 1.14 KB
/
Copy pathupdate-lessons.yml
File metadata and controls
46 lines (39 loc) 路 1.14 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
name: Update lessons.json
on:
schedule:
- cron: "0 0 * * *" # Daily at 08:00 Beijing time
workflow_dispatch: # Manual trigger for release prep
permissions:
contents: read
jobs:
update:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Regenerate lessons.json
run: python3 scripts/update_lessons_json.py
- name: Check for changes
id: check
run: |
if git diff --quiet data/lessons.json; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit and push
if: steps.check.outputs.changed == 'true'
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git add data/lessons.json
git commit -m "chore: auto-update lessons.json"
git push