Skip to content

Commit 5f70167

Browse files
authored
GODRIVER-2978 Remove branch synching workflow and improve local script (#1403)
1 parent 420fea3 commit 5f70167

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

etc/cherry-picker.sh

+18-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [ -z "$user" ]; then
1414
fi
1515

1616
mkdir -p $dirname
17-
if [ -z $AUTH_TOKEN ]; then
17+
if [ -z "$AUTH_TOKEN" ]; then
1818
git clone [email protected]:mongodb/mongo-go-driver.git $dirname
1919
else
2020
echo "$AUTH_TOKEN" > mytoken.txt
@@ -23,7 +23,7 @@ else
2323
fi
2424

2525
cd $dirname
26-
if [ -z $AUTH_TOKEN ]; then
26+
if [ -z "$AUTH_TOKEN" ]; then
2727
git remote add $user [email protected]:$user/mongo-go-driver.git
2828
else
2929
git remote add $user https://$user:${AUTH_TOKEN}@github.com/$user/mongo-go-driver.git
@@ -35,7 +35,20 @@ head="$user:$branch"
3535
git fetch origin $base
3636
git fetch origin $target
3737
git checkout -b $branch origin/$target
38-
git cherry-pick -x $sha
38+
git cherry-pick -x $sha || true
39+
40+
files=$(git ls-files -m)
41+
if [ -n "${files}" ]; then
42+
EDITOR=${EDITOR:-$(git config core.editor)}
43+
EDITOR=${EDITOR:-vim}
44+
for fname in $files; do
45+
echo "Fixing $fname..."
46+
$EDITOR $fname
47+
git add $fname
48+
done
49+
echo "Finishing cherry pick."
50+
git cherry-pick --continue
51+
fi
3952

4053
old_title=$(git --no-pager log -1 --pretty=%B | head -n 1)
4154
ticket=$(echo $old_title | sed -r 's/([A-Z]+-[0-9]+).*/\1/')
@@ -53,14 +66,14 @@ echo "Base: $target"
5366
echo "Head: $head"
5467
echo
5568

56-
if [ -n $GITHUB_ACTOR ]; then
69+
if [ -n "$GITHUB_ACTOR" ]; then
5770
choice=Y
5871
else
5972
read -p 'Push changes? (Y/n) ' choice
6073
fi
6174

6275
if [[ "$choice" == "Y" || "$choice" == "y" || -z "$choice" ]]; then
63-
if [ -n $user ]; then
76+
if [ -n "$user" ]; then
6477
git push $user
6578
fi
6679
gh pr create --title "$title" --base $target --head $head --body "$body"

etc/get_aws_secrets.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ if [ -z "$DRIVERS_TOOLS" ]; then
88
exit 1
99
fi
1010

11-
bash $DRIVERS_TOOLS/.evergreen/auth_aws/setup_secrets.sh $@
11+
bash $DRIVERS_TOOLS/.evergreen/auth_aws/setup_secrets.sh "$@"
1212
. ./secrets-export.sh

0 commit comments

Comments
 (0)