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