diff --git a/etc/cherry-picker.sh b/etc/cherry-picker.sh index 6d690594a4..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 @@ -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