Skip to content

Commit

Permalink
GODRIVER-2978 Remove branch synching workflow and improve local script (
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Sep 27, 2023
1 parent 420fea3 commit 5f70167
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
23 changes: 18 additions & 5 deletions etc/cherry-picker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [ -z "$user" ]; then
fi

mkdir -p $dirname
if [ -z $AUTH_TOKEN ]; then
if [ -z "$AUTH_TOKEN" ]; then
git clone [email protected]:mongodb/mongo-go-driver.git $dirname
else
echo "$AUTH_TOKEN" > mytoken.txt
Expand All @@ -23,7 +23,7 @@ else
fi

cd $dirname
if [ -z $AUTH_TOKEN ]; then
if [ -z "$AUTH_TOKEN" ]; then
git remote add $user [email protected]:$user/mongo-go-driver.git
else
git remote add $user https://$user:${AUTH_TOKEN}@github.com/$user/mongo-go-driver.git
Expand All @@ -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/')
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion etc/get_aws_secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5f70167

Please sign in to comment.