This repository was archived by the owner on Jul 23, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (50 loc) · 1.89 KB
/
sync_with_openlist.yaml
File metadata and controls
59 lines (50 loc) · 1.89 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: Sync the Newest OpenList
on:
schedule:
- cron: '0 23 * * *'
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout self
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.WF_TOKEN }}
- name: Backup critical files
run: |
cp .github/workflows/sync_with_openlist.yaml /tmp/sync_with_openlist.yaml.bak
cp .github/workflows/daily.yml /tmp/daily.yml.bak
cp .github/workflows/docker.yml /tmp/docker.yml.bak
cp README.md /tmp/README.md.bak
cp README.zhcn.md /tmp/README.zhcn.md.bak
- name: Force mirror update
run: |
git remote add upstream https://github.com/OpenListTeam/OpenList.git || true
git fetch upstream
git reset --hard upstream/main
git clean -fd -x
- name: Restore critical files
run: |
mkdir -p .github/workflows
cp /tmp/sync_with_openlist.yaml.bak .github/workflows/sync_with_openlist.yaml
cp /tmp/daily.yml.bak .github/workflows/daily.yml
cp /tmp/docker.yml.bak .github/workflows/docker.yml
cp /tmp/README.md.bak README.md
cp /tmp/README.zhcn.md.bak README.zhcn.md
- name: Commit and push
run: |
git config --global user.name "OpenList Syncer"
git config --global user.email "openlistsyncer@ilovescratch.dpdns.org"
git add .github/workflows/daily.yml
git add .github/workflows/docker.yml
git add .github/workflows/sync_with_openlist.yaml
git add README.md
git add README.zhcn.md
if git diff-index --quiet HEAD --; then
echo "No changes to commit"
else
git commit -m "Sync: sync the newest OpenList $(date +'%Y-%m-%d')"
git push --force origin main
fi