Update
This commit is contained in:
+13
-15
@@ -61,26 +61,24 @@ jobs:
|
|||||||
rsync -av --include="*/" --include="*$EXT" --exclude="*" ./ backup/
|
rsync -av --include="*/" --include="*$EXT" --exclude="*" ./ backup/
|
||||||
done
|
done
|
||||||
|
|
||||||
# 检查当前分支的.github/workflows/main.yml文件与上游分支的是否一致
|
# 检查当前分支的.github/workflows/main.yml文件是否与上游分支的一致
|
||||||
- name: Check consistency of main.yml file
|
- name: Check if main.yml file is consistent
|
||||||
run: |
|
run: |
|
||||||
if ! cmp -s .github/workflows/main.yml <(git show upstream/main:.github/workflows/main.yml); then
|
DIFF=$(git diff --name-only upstream/main .github/workflows/main.yml)
|
||||||
|
if [[ -n "$DIFF" ]]; then
|
||||||
echo "main.yml file is inconsistent"
|
echo "main.yml file is inconsistent"
|
||||||
touch exclude_main_file_flag
|
else
|
||||||
|
echo "main.yml file is consistent"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 将上游main分支的更改强制推送到当前main分支(如果存在,则排除.github/workflows/main.yml文件)
|
# 排除.github/workflows/main.yml文件,避免对其进行任何修改
|
||||||
- name: Force push changes from upstream to current main branch
|
- name: Exclude main.yml from changes
|
||||||
|
run: |
|
||||||
|
git restore --staged .github/workflows/main.yml
|
||||||
|
|
||||||
|
# 将更改强制推送到main分支
|
||||||
|
- name: Force push changes to main branch
|
||||||
run: |
|
run: |
|
||||||
git checkout main
|
|
||||||
git reset --hard upstream/main
|
|
||||||
if [ -f exclude_main_file_flag ]; then
|
|
||||||
git reset HEAD .github/workflows/main.yml
|
|
||||||
git checkout -- .github/workflows/main.yml
|
|
||||||
rm exclude_main_file_flag
|
|
||||||
fi
|
|
||||||
git add .
|
|
||||||
git commit -m "Update from GitHub Actions" || true
|
|
||||||
git push origin main --force
|
git push origin main --force
|
||||||
|
|
||||||
# 从备份目录将指定后缀文件还原到当前目录及子目录中,然后删除备份目录
|
# 从备份目录将指定后缀文件还原到当前目录及子目录中,然后删除备份目录
|
||||||
|
|||||||
Reference in New Issue
Block a user