Update main.yml
This commit is contained in:
@@ -32,15 +32,10 @@ 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
|
||||||
|
|
||||||
# Backup local .txt files
|
- name: Backup local .txt files # 创建一个备份目录,并将当前目录中的所有.txt文件复制到备份目录
|
||||||
- name: Backup local .txt files
|
|
||||||
run: |
|
run: |
|
||||||
mkdir backup
|
mkdir backup
|
||||||
if find . -maxdepth 1 -name "*.txt" -print -quit | grep -q .; then
|
cp *.txt backup/ || echo "No .txt files to backup"
|
||||||
cp *.txt backup/
|
|
||||||
else
|
|
||||||
echo "No .txt files to backup"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Force push changes from upstream to current main branch # 将上游main分支的更改强制推送到当前main分支
|
- name: Force push changes from upstream to current main branch # 将上游main分支的更改强制推送到当前main分支
|
||||||
run: |
|
run: |
|
||||||
@@ -48,18 +43,10 @@ jobs:
|
|||||||
git reset --hard upstream/main
|
git reset --hard upstream/main
|
||||||
git push origin main --force
|
git push origin main --force
|
||||||
|
|
||||||
# Restore local .txt files and delete backup
|
- name: Restore local .txt files and delete backup # 从备份目录将.txt文件还原到当前目录,然后删除备份目录
|
||||||
- name: Restore local .txt files and delete backup
|
|
||||||
run: |
|
run: |
|
||||||
if find backup -maxdepth 1 -name "*.txt" -print -quit | grep -q .; then
|
cp backup/*.txt . || echo "No .txt files to restore"
|
||||||
cp backup/*.txt .
|
|
||||||
rm -rf backup
|
rm -rf backup
|
||||||
git checkout main
|
|
||||||
git reset --hard upstream/main
|
|
||||||
git push origin main --force
|
|
||||||
else
|
|
||||||
echo "No .txt files to restore"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Run main.py # 运行主程序main.py
|
- name: Run main.py # 运行主程序main.py
|
||||||
run: python main.py
|
run: python main.py
|
||||||
@@ -81,6 +68,4 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git commit -m "Update from GitHub Actions" || true # 如果没有更改,则允许提交失败,但不中断workflow
|
git commit -m "Update from GitHub Actions" || true # 如果没有更改,则允许提交失败,但不中断workflow
|
||||||
|
|
||||||
- name: Force push changes to main branch # 将更改强制推送到main分支
|
- name: Force push changes to main branch # 将更改强
|
||||||
run: |
|
|
||||||
git push origin main --force
|
|
||||||
|
|||||||
Reference in New Issue
Block a user