-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-all-prs.sh
executable file
·34 lines (33 loc) · 1.17 KB
/
update-all-prs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
remote_name="origin"
cd ..
for item in *; do
if [[ -d "$item" ]]; then
cd "${item}" || exit
echo "---*** Updating PRs in project $item ***---"
if git ls-remote --exit-code --heads "$remote_name" "master"; then
master_branch="master"
fi
if git ls-remote --exit-code --heads "$remote_name" "main"; then
master_branch="main"
fi
if [ -n "${master_branch}" ]; then
git checkout "${master_branch}"
fi
git pull
git fetch -p
for branch_name in $(git branch -r | grep -v '\->' | sed 's/origin\///' | grep -v 'master' | grep -v 'main' | grep -v 'migration-to-kotlin' | grep -v '1.0.0-eol-continuous-release-branch-recovered' | grep -v 'migrate-to-kotlin'); do
echo "Processing branch: $branch_name"
if [ -n "${master_branch}" ]; then
git checkout "${branch_name}"
git pull
git merge origin/"${master_branch}" --no-edit
git push
gh pr merge $(gh pr list --base "${master_branch}" --head "${branch_name}" --json number --jq '.[0].number' | xargs echo) --auto --merge
git checkout "${master_branch}"
fi
done
cd ..
fi
done
cd project-signer || exit