Skip to content

Commit 8acc6ed

Browse files
author
ILoveScratch Syncer: Sync and add workflow
committed
ADD SYNC: Restore workflow 2025-02-25
1 parent ed28a57 commit 8acc6ed

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/sync.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Sync with GitLab
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
sync:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout self
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
token: ${{ secrets.WF_TOKEN }}
17+
18+
- name: Backup workflow
19+
run: cp .github/workflows/sync.yml /tmp/sync.yml.bak
20+
21+
22+
- name: Force mirror update
23+
run: |
24+
git remote add upstream https://gitlab.com/Binaryify/neteasecloudmusicapi.git
25+
git fetch upstream
26+
git reset --hard upstream/main
27+
git clean -fd -x
28+
29+
- name: Restore workflow
30+
run: |
31+
mkdir -p .github/workflows
32+
cp /tmp/sync.yml.bak .github/workflows/sync.yml
33+
34+
- name: Commit and push
35+
run: |
36+
git config --global user.name "ILoveScratch Syncer: Sync and add workflow"
37+
git config --global user.email "sync@ilovescratch.com"
38+
git add .github/workflows
39+
if git diff-index --quiet HEAD --; then
40+
echo "No changes to commit"
41+
else
42+
git commit -m "ADD SYNC: Restore workflow $(date +'%Y-%m-%d')"
43+
git push --force origin main
44+
fi

0 commit comments

Comments
 (0)