-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40976b9
commit 168a1c4
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Sync from Gitee | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '20 5 * * *' # UTC时区; 每天执行一次 | ||
|
||
jobs: | ||
sync: | ||
if: github.ref == 'refs/heads/main' # 仅当在main分支上时才执行 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Pull changes from Gitee | ||
run: | | ||
git remote add gitee https://gitee.com/we-mid/go.git | ||
git fetch gitee main | ||
# todo: 暂未解决: 如无变更应避免操作 从而持续破坏提交记录 | ||
# fix: Committer identity unknown | ||
git config user.email "actions@github.com" | ||
git config user.name "GitHub Actions" | ||
# 避免额外提交: Merge remote-tracking branch 'xx/xxx' | ||
# git merge gitee/main --allow-unrelated-histories | ||
# git push origin main | ||
# 使用 rebase 而不是 merge | ||
git rebase gitee/main | ||
git push origin main --force-with-lease |