This commit is contained in:
NianBroken
2024-02-13 13:45:07 +08:00 Unverified
parent 8e34de379b
commit f7655ed7a1
+6 -21
View File
@@ -41,16 +41,14 @@ jobs:
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
# 添加上游仓库作为远程仓库,并获取上游仓库的main分支最新更改
- name: Fetch upstream changes
# 拉取上游 main 分支最新代码并强制覆盖当前分支的 .github/workflows/main.yml 文件
- name: Fetch and override upstream workflows
run: |
git remote add upstream https://github.com/NianBroken/ZFCheckScores.git
git fetch upstream main
# 将上游main分支的 .github/workflows/main.yml 文件内容复制到当前仓库
- name: Copy upstream main.yml to current repository
run: |
cp /.github/workflows/main.yml .github/workflows/main.yml
git checkout upstream/main .github/workflows/main.yml
git add .github/workflows/main.yml
git commit -m "Override main.yml from upstream"
git push origin main
# 创建一个备份目录,并将当前目录中的所有.txt文件复制到备份目录
- name: Backup local .txt files
@@ -58,19 +56,6 @@ jobs:
mkdir -p backup
cp -r *.txt backup/ || echo "No .txt files to backup"
# 将上游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
# 从备份目录将.txt文件还原到当前目录,然后删除备份目录
- name: Restore local .txt files and delete backup
run: |
cp -r backup/*.txt . || echo "No .txt files to restore"
rm -rf backup
# 运行主程序main.py
- name: Run main.py
env: