diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 63d8965..1f05c3d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,7 +82,7 @@ jobs: # 创建一个备份目录,并将当前目录及子目录中的所有指定后缀文件复制到备份目录,并保持路径 mkdir -p backup for EXT in $FILE_EXTENSIONS; do - find . -type f -name "*$EXT" -exec rsync -avR {} backup/ \; + rsync -av --include="*/" --include="*$EXT" --exclude="*" ./ backup/ done - name: List Backup Folder Structure @@ -102,10 +102,10 @@ jobs: - name: Restore local files with specified extensions and delete backup run: | # 从备份目录将指定后缀文件还原到当前目录及子目录中,然后删除备份目录 - mkdir -p backup for EXT in $FILE_EXTENSIONS; do - find . -type f -name "*$EXT" -not -path "./backup/*" -exec rsync -avR {} backup/ \; + rsync -av --include="*/" --include="*$EXT" --exclude="*" backup/ ./ done + rm -rf backup - name: Force push changes to main branch run: | @@ -242,4 +242,4 @@ jobs: # 备份main分支到OldMain分支 echo "${{ needs.CheckScores.outputs.BEIJING_TIME }}" git checkout -b OldMain|| git checkout OldMain - git push -f origin OldMain + git push -f origin OldMain \ No newline at end of file