-
Notifications
You must be signed in to change notification settings - Fork 891
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GODRIVER-2978 Remove branch synching workflow and improve local script (
- Loading branch information
Showing
2 changed files
with
19 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters