This commit is contained in:
NianBroken
2024-02-13 15:03:52 +08:00 Unverified
parent 2acbaaa4ff
commit 238a4bbe28
+15 -6
View File
@@ -47,11 +47,18 @@ jobs:
git remote add upstream https://github.com/NianBroken/ZFCheckScores.git git remote add upstream https://github.com/NianBroken/ZFCheckScores.git
git fetch upstream main git fetch upstream main
# 创建一个备份目录,并将当前目录及子目录中的所有.txt文件复制到备份目录,并保持路径,输出文件路径 # 文件后缀列表
- name: Backup local .txt files - name: Set file extensions
run: |
FILE_EXTENSIONS=".txt .jpg .png" # 以空格分隔多个文件后缀
# 创建一个备份目录,并将当前目录及子目录中的所有指定后缀文件复制到备份目录,并保持路径
- name: Backup local files with specified extensions
run: | run: |
mkdir -p backup mkdir -p backup
rsync -av --include="*/" --include="*.txt" --exclude="*" ./ backup/ | awk '{print $NF}' for EXT in $FILE_EXTENSIONS; do
rsync -av --include="*/" --include="*$EXT" --exclude="*" ./ backup/
done
# 将上游main分支的更改强制推送到当前main分支 # 将上游main分支的更改强制推送到当前main分支
- name: Force push changes from upstream to current main branch - name: Force push changes from upstream to current main branch
@@ -67,10 +74,12 @@ jobs:
echo "3. 点击 Update branch 或 Discard xxx commits"; echo "3. 点击 Update branch 或 Discard xxx commits";
done; exit 1) done; exit 1)
# 从备份目录将.txt文件还原到当前目录及子目录中,然后删除备份目录,输出文件路径 # 从备份目录将指定后缀文件还原到当前目录及子目录中,然后删除备份目录
- name: Restore local .txt files and delete backup - name: Restore local files with specified extensions and delete backup
run: | run: |
rsync -av --include="*/" --include="*.txt" --exclude="*" backup/ ./ | awk '{print $NF}' for EXT in $FILE_EXTENSIONS; do
rsync -av --include="*/" --include="*$EXT" --exclude="*" backup/ ./
done
rm -rf backup rm -rf backup
# 运行主程序main.py # 运行主程序main.py