From a016a1cec16cd4b6f5c6b93b85969385553c16e4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 26 Sep 2023 20:28:53 -0500 Subject: [PATCH 1/2] GODRIVER-2978 Remove branch synching workflow and improve local script --- etc/cherry-picker.sh | 19 ++++++++++++++++--- etc/get_aws_secrets.sh | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/etc/cherry-picker.sh b/etc/cherry-picker.sh index 6d690594a4..bca69e25a5 100755 --- a/etc/cherry-picker.sh +++ b/etc/cherry-picker.sh @@ -35,7 +35,20 @@ head="$user:$branch" git fetch origin $base git fetch origin $target git checkout -b $branch origin/$target -git cherry-pick -x $sha +git cherry-pick -x $sha || true + +files=$(git ls-files -m) +if [ -n "${files}" ]; then + EDITOR=${EDITOR:-$(git config core.editor)} + EDITOR=${EDITOR:-vim} + for fname in $files; do + echo "Fixing $fname..." + $EDITOR $fname + git add $fname + done + echo "Finishing cherry pick." + git cherry-pick --continue +fi old_title=$(git --no-pager log -1 --pretty=%B | head -n 1) ticket=$(echo $old_title | sed -r 's/([A-Z]+-[0-9]+).*/\1/') @@ -53,14 +66,14 @@ echo "Base: $target" echo "Head: $head" echo -if [ -n $GITHUB_ACTOR ]; then +if [ -n "$GITHUB_ACTOR" ]; then choice=Y else read -p 'Push changes? (Y/n) ' choice fi if [[ "$choice" == "Y" || "$choice" == "y" || -z "$choice" ]]; then - if [ -n $user ]; then + if [ -n "$user" ]; then git push $user fi gh pr create --title "$title" --base $target --head $head --body "$body" diff --git a/etc/get_aws_secrets.sh b/etc/get_aws_secrets.sh index 894016553b..04475ded45 100644 --- a/etc/get_aws_secrets.sh +++ b/etc/get_aws_secrets.sh @@ -8,5 +8,5 @@ if [ -z "$DRIVERS_TOOLS" ]; then exit 1 fi -bash $DRIVERS_TOOLS/.evergreen/auth_aws/setup_secrets.sh $@ +bash $DRIVERS_TOOLS/.evergreen/auth_aws/setup_secrets.sh "$@" . ./secrets-export.sh From 203d831e3e2ad52825bf91cf671d4d65cb67d06d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 27 Sep 2023 08:37:36 -0500 Subject: [PATCH 2/2] address review --- etc/cherry-picker.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/cherry-picker.sh b/etc/cherry-picker.sh index bca69e25a5..b513c685a1 100755 --- a/etc/cherry-picker.sh +++ b/etc/cherry-picker.sh @@ -14,7 +14,7 @@ if [ -z "$user" ]; then fi mkdir -p $dirname -if [ -z $AUTH_TOKEN ]; then +if [ -z "$AUTH_TOKEN" ]; then git clone git@github.com:mongodb/mongo-go-driver.git $dirname else echo "$AUTH_TOKEN" > mytoken.txt @@ -23,7 +23,7 @@ else fi cd $dirname -if [ -z $AUTH_TOKEN ]; then +if [ -z "$AUTH_TOKEN" ]; then git remote add $user git@github.com:$user/mongo-go-driver.git else git remote add $user https://$user:${AUTH_TOKEN}@github.com/$user/mongo-go-driver.git