forked from duolabmeng6/qtAutoUpdateApp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release update-feature-branches.yaml
- Loading branch information
Showing
1 changed file
with
22 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,28 +16,29 @@ jobs: | |
- name: Fetch all branches | ||
run: git fetch --all | ||
|
||
- name: Get branch list | ||
- name: Merge changes to other branches | ||
run: | | ||
git branch -r --no-abbrev --list 'origin/feature/*' | sed 's/origin\///' | sed 's/^[[:space:]]*//' > branch_list.txt | ||
cat branch_list.txt | ||
|
||
- name: Update branches | ||
run: | | ||
set -e # 添加错误处理机制 | ||
git config --global user.name "[email protected]" | ||
git config --global user.email "Github Robot" | ||
while IFS= read -r branch; do | ||
if [[ "$branch" != "main" ]]; then | ||
# 获取所有分支列表 | ||
branches=$(git branch --list --format="%(refname:lstrip=2)") | ||
# 遍历分支列表 | ||
for branch in $branches; do | ||
# 跳过main分支 | ||
if [ "$branch" != "main" ]; then | ||
# 切换到分支 | ||
git checkout "$branch" | ||
git merge origin/main --no-edit --allow-unrelated-histories || true | ||
if [[ $? -eq 0 ]]; then | ||
git add --ignore-errors . # 添加文件并忽略错误 | ||
git commit -m "Merge changes from main branch" | ||
git push origin "$branch" | ||
else | ||
echo "Skipping branch $branch due to conflicts" | ||
fi | ||
# 合并main分支的变更 | ||
git merge main --no-commit | ||
# 提交合并结果 | ||
git commit -m "Merge changes from main" | ||
# 推送到远程分支 | ||
git push origin "$branch" | ||
fi | ||
done < branch_list.txt | ||
done | ||
# 切换回main分支 | ||
git checkout main | ||