-
-
Save sergiitk/af606cbab72b00d8db8a53d21e766ee9 to your computer and use it in GitHub Desktop.
Revisions
-
sergiitk revised this gist
Apr 16, 2025 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -46,13 +46,19 @@ main() { readonly pr_metadata="$(curl -sSf -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/grpc/${repo}/pulls/$pr")" readonly assignee="$(echo "$pr_metadata" | jq -r '.assignee.login')" # assignee="" if [[ -n "${COMMITS}" ]]; then readonly commits=${COMMITS} else readonly commits="$(echo "$pr_metadata" | jq -r '.merge_commit_sha')" fi readonly branch_id="$(echo "$pr_metadata" | jq -r '.head.ref')" readonly title="$(echo "$pr_metadata" | jq -r '.title')" readonly body="$(echo "$pr_metadata" | jq -r '.body')" cat <<EOT PR: https://github.com/grpc/${repo}/pull/$pr Title: ${title} Versions: ${minors} Commits: ${commits} Branch id: ${branch_id} -
sergiitk revised this gist
Dec 16, 2023 . No changes.There are no files selected for viewing
-
sergiitk revised this gist
May 31, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #!/usr/bin/env bash # Copyright 2020 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -88,7 +88,7 @@ EOT fi git checkout -b "${backport_branch}" "upstream/${version_tag}" pick_result=0 git cherry-pick --rerere-autoupdate -m 1 $commits || pick_result=$? if [[ $pick_result -ne 0 ]]; then read -n 1 -p "Conflict detected. Resolve manually in another shell. Resolved? (y/N) " answer if [ "$answer" != "${answer#[Yy]}" ] ;then -
sergiitk revised this gist
Nov 9, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -134,4 +134,4 @@ EOT git checkout "${orig_branch}" } main "$@" -
sergiitk revised this gist
Nov 9, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -134,4 +134,4 @@ EOT git checkout "${orig_branch}" } main "$@" -
sergiitk revised this gist
Sep 7, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -107,7 +107,7 @@ EOT arg_title="${title} (${version_tag} backport)" arg_body=$(cat <<EOT Backport of #${pr} to ${version_tag}. --- ${body} EOT ) -
sergiitk revised this gist
Sep 7, 2022 . 1 changed file with 9 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -23,6 +23,7 @@ EXAMPLES: $0 grpc-go 5434 47 46 45 $0 grpc 5434 47 $0 grpc-java 5434 {47..38} $0 grpc-node 2208 5 6 7 EOF exit 1 } @@ -80,10 +81,14 @@ EOT for minor in $minors; do backport_branch="backport-1.$minor-${branch_id}" if [[ "${repo}" == "grpc-node" ]]; then version_tag="@grpc/grpc-js@1.${minor}.x" else version_tag="v1.${minor}.x" fi git checkout -b "${backport_branch}" "upstream/${version_tag}" pick_result=0 git cherry-pick -m 1 $commits || pick_result=$? if [[ $pick_result -ne 0 ]]; then read -n 1 -p "Conflict detected. Resolve manually in another shell. Resolved? (y/N) " answer if [ "$answer" != "${answer#[Yy]}" ] ;then @@ -107,7 +112,8 @@ ${body} EOT ) # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/using-query-parameters-to-create-a-pull-request url="https://github.com/grpc/${repo}/compare" url="${url}/$(urlencode "${version_tag}")...${owner}:${backport_branch}?quick_pull=1" url="${url}&title=$(urlencode "${arg_title}")" url="${url}&body=$(urlencode "${arg_body}")" if [[ "${assignee}" != "null" ]]; then -
sergiitk revised this gist
Sep 7, 2022 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -38,6 +38,7 @@ main() { readonly repo="$1" readonly pr="$2" readonly labels="${LABELS:-}" shift 2 readonly minors="$@" readonly owner="$(git remote get-url origin | sed -E "s#.*[:/]([a-zA-Z0-9-]+)/${repo}.*#\1#")" @@ -56,6 +57,7 @@ Commits: ${commits} Branch id: ${branch_id} Repo: ${owner} Assignee: ${assignee} Labels: ${labels} EOT read -n 1 -p "Continue? (y/N) " answer @@ -77,7 +79,7 @@ EOT local url for minor in $minors; do backport_branch="backport-1.$minor-${branch_id}" version_tag="v1.${minor}.x" git checkout -b "${backport_branch}" "upstream/${version_tag}" pick_result=0 @@ -111,6 +113,9 @@ EOT if [[ "${assignee}" != "null" ]]; then url="${url}&assignees=${assignee}" fi if [[ -n "${labels}" ]]; then url="${url}&labels=$(urlencode "${labels}")" fi echo echo -
sergiitk revised this gist
Sep 6, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -120,7 +120,7 @@ EOT echo echo done git checkout "${orig_branch}" } main "$@" -
sergiitk revised this gist
Sep 6, 2022 . 1 changed file with 29 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -51,11 +51,11 @@ main() { cat <<EOT PR: https://github.com/grpc/${repo}/pull/$pr Versions: ${minors} Commits: ${commits} Branch id: ${branch_id} Repo: ${owner} Assignee: ${assignee} EOT read -n 1 -p "Continue? (y/N) " answer @@ -69,14 +69,17 @@ EOT git fetch upstream readonly orig_branch="$(git rev-parse --abbrev-ref HEAD)" local pick_result local backport_branch local arg_title local arg_body local version_tag local url for minor in $minors; do backport_branch="backport-${branch_id}-1.$minor" version_tag="v1.${minor}.x" git checkout -b "${backport_branch}" "upstream/${version_tag}" pick_result=0 git cherry-pick $commits || pick_result=$? if [[ $pick_result -ne 0 ]]; then @@ -92,17 +95,32 @@ EOT exit 1 fi fi git push --set-upstream origin "${backport_branch}" arg_title="${title} (${version_tag} backport)" arg_body=$(cat <<EOT Backport of #${pr} to ${version_tag}. ${body} EOT ) # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/using-query-parameters-to-create-a-pull-request url="https://github.com/grpc/${repo}/compare/${version_tag}...${owner}:${backport_branch}?quick_pull=1" url="${url}&title=$(urlencode "${arg_title}")" url="${url}&body=$(urlencode "${arg_body}")" if [[ "${assignee}" != "null" ]]; then url="${url}&assignees=${assignee}" fi echo echo echo ------------------------------------------------------ echo "${url}" echo ------------------------------------------------------ echo echo done # git checkout "${orig_branch}" } main "$@" -
sergiitk revised this gist
Aug 9, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -97,7 +97,7 @@ EOT echo echo echo ------------------------------------------------------ echo "https://github.com/grpc/${repo}/compare/v1.$minor.x...$owner:${backport_branch}?expand=1&assignees=$assignee&title=$(urlencode "$title")%20%281.$minor.x%20backport%29&body=Backport%20of%20%23${pr}%0A%0A$(urlencode "$body")" echo ------------------------------------------------------ echo echo -
sergiitk revised this gist
Jul 12, 2022 . No changes.There are no files selected for viewing
-
sergiitk revised this gist
Jun 17, 2022 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -27,6 +27,10 @@ EOF exit 1 } urlencode() { python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$*" } main() { if (( $# < 3 )); then display_usage @@ -63,10 +67,6 @@ EOT exit 1 fi git fetch upstream readonly orig_branch="$(git rev-parse --abbrev-ref HEAD)" #readonly title="$(git log -1 --pretty=format:%s "$commit")" -
sergiitk revised this gist
Jun 17, 2022 . 1 changed file with 76 additions and 42 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -15,25 +15,37 @@ set -e display_usage() { cat <<EOF >/dev/stderr Usage: $0 REPO PR MINOR_VERSIONS EXAMPLES: $0 grpc-go 5434 47 46 45 $0 grpc 5434 47 $0 grpc-java 5434 {47..38} EOF exit 1 } main() { if (( $# < 3 )); then display_usage fi readonly repo="$1" readonly pr="$2" shift 2 readonly minors="$@" readonly owner="$(git remote get-url origin | sed -E "s#.*[:/]([a-zA-Z0-9-]+)/${repo}.*#\1#")" readonly pr_metadata="$(curl -sSf -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/grpc/${repo}/pulls/$pr")" readonly assignee="$(echo "$pr_metadata" | jq -r '.assignee.login')" readonly commits="$(echo "$pr_metadata" | jq -r '.merge_commit_sha')" readonly branch_id="$(echo "$pr_metadata" | jq -r '.head.ref')" readonly title="$(echo "$pr_metadata" | jq -r '.title')" readonly body="$(echo "$pr_metadata" | jq -r '.body')" cat <<EOT PR: https://github.com/grpc/${repo}/pull/$pr Versions: $minors Assignee: $assignee @@ -42,33 +54,55 @@ Branch id: $branch_id Repo: $owner EOT read -n 1 -p "Continue? (y/N) " answer if [ "$answer" != "${answer#[Yy]}" ] ;then echo else echo echo "Exit" exit 1 fi urlencode() { python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$*" } git fetch upstream readonly orig_branch="$(git rev-parse --abbrev-ref HEAD)" #readonly title="$(git log -1 --pretty=format:%s "$commit")" #readonly body="$(git log -1 --pretty=format:%b "$commit")" local pick_result local backport_branch for minor in $minors; do backport_branch="backport-${branch_id}-1.$minor" git checkout -b "${backport_branch}" "upstream/v1.$minor.x" pick_result=0 git cherry-pick $commits || pick_result=$? if [[ $pick_result -ne 0 ]]; then read -n 1 -p "Conflict detected. Resolve manually in another shell. Resolved? (y/N) " answer if [ "$answer" != "${answer#[Yy]}" ] ;then echo echo "Continuing..." else echo echo "Aborting. Cleaning up..." git checkout -f "${orig_branch}" git branch -D "${backport_branch}" exit 1 fi fi git push --set-upstream origin "${backport_branch}" echo echo echo ------------------------------------------------------ echo "https://github.com/grpc/${repo}/compare/v1.$minor.x...$owner:${backport_branch}?expand=1&assignees=$assignee&title=$(urlencode "$title")%20%281.$minor.x%20backport%29&body=$(urlencode "$body")%0A%0ABackport%20of%20%23$pr" echo ------------------------------------------------------ echo echo done git checkout "${orig_branch}" } main "$@" -
sergiitk revised this gist
Jun 17, 2022 . 1 changed file with 20 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -15,32 +15,41 @@ set -e if (( $# < 3 )); then echo "Usage: $0 REPO PR MINOR_VERSIONS" exit 1 fi readonly repo="$1" readonly pr="$2" shift 2 readonly minors="$@" readonly owner="$(git remote get-url origin | sed -E "s#.*[:/]([a-zA-Z0-9-]+)/${repo}.*#\1#")" readonly pr_metadata="$(curl -sSf -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/grpc/${repo}/pulls/$pr")" readonly assignee="$(echo "$pr_metadata" | jq -r '.assignee.login')" readonly commits="$(echo "$pr_metadata" | jq -r '.merge_commit_sha')" readonly branch_id="$(echo "$pr_metadata" | jq -r '.head.ref')" readonly title="$(echo "$pr_metadata" | jq -r '.title')" readonly body="$(echo "$pr_metadata" | jq -r '.body')" cat <<EOT PR: https://github.com/grpc/${repo}/pull/$pr Versions: $minors Assignee: $assignee Commits: $commits Branch id: $branch_id Repo: $owner EOT read -n 1 -p "Continue? (y/N) " answer if [ "$answer" != "${answer#[Yy]}" ] ;then echo else echo echo "Exit" exit 1 fi urlencode() { python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$*" @@ -57,9 +66,9 @@ for minor in $minors; do echo echo echo ------------------------------------------------------ echo "https://github.com/grpc/${repo}/compare/v1.$minor.x...$owner:backport-${branch_id}-1.$minor?expand=1&assignees=$assignee&title=$(urlencode "$title")%20%281.$minor.x%20backport%29&body=$(urlencode "$body")%0A%0ABackport%20of%20%23$pr" echo ------------------------------------------------------ echo echo done git checkout "$orig_branch" -
ejona86 revised this gist
May 12, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -43,7 +43,7 @@ EOT read -p "Continue? " urlencode() { python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$*" } git fetch upstream -
ejona86 created this gist
Dec 7, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ #!/bin/bash # Copyright 2020 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -e if [[ $# < 2 ]]; then echo "Usage: $0 PR MINOR_VERSIONS" exit 1 fi readonly pr="$1" readonly minors="$2" readonly repo="$(git remote get-url origin | sed -E 's#.*[:/]([a-zA-Z0-9-]+)/grpc-java.*#\1#')" readonly pr_metadata="$(curl -sSf -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/grpc/grpc-java/pulls/$pr")" readonly assignee="$(echo "$pr_metadata" | jq -r '.assignee.login')" readonly commits="$(echo "$pr_metadata" | jq -r '.merge_commit_sha')" readonly branch_id="$(echo "$pr_metadata" | jq -r '.head.ref')" readonly title="$(echo "$pr_metadata" | jq -r '.title')" readonly body="$(echo "$pr_metadata" | jq -r '.body')" cat <<EOT PR: https://github.com/grpc/grpc-java/pull/$pr Versions: $minors Assignee: $assignee Commits: $commits Branch id: $branch_id Repo: $repo EOT read -p "Continue? " urlencode() { python -c "import urllib, sys; print urllib.quote(sys.argv[1])" "$*" } git fetch upstream readonly orig_branch="$(git rev-parse --abbrev-ref HEAD)" #readonly title="$(git log -1 --pretty=format:%s "$commit")" #readonly body="$(git log -1 --pretty=format:%b "$commit")" for minor in $minors; do git checkout -b "backport-${branch_id}-1.$minor" "upstream/v1.$minor.x" git cherry-pick $commits git push --set-upstream origin "backport-${branch_id}-1.$minor" echo echo echo ------------------------------------------------------ echo "https://github.com/grpc/grpc-java/compare/v1.$minor.x...$repo:backport-${branch_id}-1.$minor?expand=1&assignees=$assignee&title=$(urlencode "$title")%20%281.$minor.x%20backport%29&body=$(urlencode "$body")%0A%0ABackport%20of%20%23$pr" echo ------------------------------------------------------ echo echo done git checkout "$orig_branch"