-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dffc9ed
commit a5c1c85
Showing
1 changed file
with
20 additions
and
29 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 |
---|---|---|
@@ -1,34 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
all_pr_branches=("update-cypress-dependencies-and-containers" "update-gradle" "update-npm-dependencies") | ||
remote_name="origin" | ||
if [ -f Makefile ]; then | ||
if grep -q "^accept-prs:" Makefile; then | ||
echo "---*** Accept PR Makefile command found in $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 | ||
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 fetch -p | ||
make accept-prs | ||
for branch_name in "${all_pr_branches[@]}"; do | ||
if git ls-remote --exit-code --heads "$remote_name" "$branch_name"; then | ||
echo "Remote branch '$branch_name' exists on '$remote_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 | ||
fi | ||
done | ||
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 | ||
fi | ||
done |