Skip to content

Commit 521c23d

Browse files
authored
[skip ci]fix(ci-sync): fix sync workflow (#166)
1 parent 181a05e commit 521c23d

File tree

2 files changed

+38
-23
lines changed

2 files changed

+38
-23
lines changed

.github/workflows/sync_repo.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Sync Repo
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
sync:
11+
runs-on: ubuntu-latest
12+
name: Sync Repository
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup SSH
20+
run: |
21+
mkdir -p ~/.ssh
22+
echo "${{ secrets.GITEE_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
23+
chmod 600 ~/.ssh/id_rsa
24+
ssh-keyscan gitee.com >> ~/.ssh/known_hosts
25+
26+
- name: Create single commit and push
27+
run: |
28+
git config user.name "GitHub Actions"
29+
git config user.email "[email protected]"
30+
31+
# Create a new branch
32+
git checkout --orphan new-main
33+
git add .
34+
git commit -m "Sync from GitHub: $(date)"
35+
36+
# Add Gitee remote and force push
37+
git remote add gitee ${{ vars.GITEE_REPO_URL }}
38+
git push --force gitee new-main:main

.github/workflows/sync_to_gitee.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)