Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GODRIVER-2978 Remove branch synching workflow and improve local script #1403

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions etc/cherry-picker.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to surround $AUTH_TOKEN with quotation marks at l17 and l26?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

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
Loading