Skip to content

Commit

Permalink
accepts for repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperancinha committed Nov 27, 2024
1 parent dffc9ed commit a5c1c85
Showing 1 changed file with 20 additions and 29 deletions.
49 changes: 20 additions & 29 deletions accept-all-repo-prs.sh
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

0 comments on commit a5c1c85

Please sign in to comment.