Update
This commit is contained in:
@@ -47,7 +47,7 @@ jobs:
|
||||
git remote add upstream https://github.com/NianBroken/ZFCheckScores.git
|
||||
git fetch upstream main
|
||||
|
||||
# 定义文件后缀列表
|
||||
# 定义备份和还原的文件后缀列表
|
||||
- name: Set file extensions
|
||||
run: |
|
||||
# 以空格分隔多个文件后缀
|
||||
@@ -61,24 +61,12 @@ jobs:
|
||||
rsync -av --include="*/" --include="*$EXT" --exclude="*" ./ backup/
|
||||
done
|
||||
|
||||
# 使用git checkout只检出除了.github/workflows/main.yml以外的文件
|
||||
- name: Checkout upstream changes excluding main.yml
|
||||
run: |
|
||||
git checkout upstream/main -- ':!/.github/workflows/main.yml'
|
||||
|
||||
# 将上游main分支的更改强制推送到当前main分支
|
||||
- name: Force push changes from upstream to current main branch
|
||||
run: |
|
||||
git checkout main
|
||||
git reset --hard upstream/main
|
||||
git push origin main --force || (for i in {1..10}; do
|
||||
echo "------" &&
|
||||
echo "你需要手动同步上游分支" &&
|
||||
echo "同步方法如下:" &&
|
||||
echo "1. 打开你的仓库首页:https://github.com/${{ github.repository }}" &&
|
||||
echo "2. 点击 Sync fork"&&
|
||||
echo "3. 点击 Update branch 或 Discard xxx commits";
|
||||
done; exit 1)
|
||||
git push origin main --force
|
||||
|
||||
# 从备份目录将指定后缀文件还原到当前目录及子目录中,然后删除备份目录
|
||||
- name: Restore local files with specified extensions and delete backup
|
||||
|
||||
Reference in New Issue
Block a user