From 003647bab2bbf2974f7f94e34ae84dbea832cdb8 Mon Sep 17 00:00:00 2001 From: Armin Briegel <1933192+scriptingosx@users.noreply.github.com> Date: Fri, 2 Sep 2022 12:44:58 +0200 Subject: [PATCH] updated test script --- utils/assemble.sh | 1 - utils/test-pr.sh | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/utils/assemble.sh b/utils/assemble.sh index 6234fc3..e92a9f3 100755 --- a/utils/assemble.sh +++ b/utils/assemble.sh @@ -121,7 +121,6 @@ chmod +x $destination_file if [[ $runScript -eq 1 ]]; then $destination_file "$@" exit_code=$? - echo "exit_code is $exit_code" fi # copy the script to root of repo when flag is set diff --git a/utils/test-pr.sh b/utils/test-pr.sh index 7d7340e..526ee56 100755 --- a/utils/test-pr.sh +++ b/utils/test-pr.sh @@ -9,17 +9,23 @@ pr_num=${1:?"arg 1 is the PR number"} label=${2:?"arg 2 is label"} -gh pr checkout $pr_num -b "pr/$pr_num" +if ! gh pr checkout $pr_num -b "pr/$pr_num"; then + exit $? +fi if ! utils/assemble.sh $label; then echo "something went wrong, stopping here" else echo - echo "All good! merging..." + echo "All good!" echo - git checkout main - git merge "pr/$pr_num" -m "new label: $label" - git branch -d "pr/$pr_num" - gh pr comment $pr_num --body 'Thank you!' + read -q query"?Merge into main? (y/n)" + + if [[ $query == 'y' ]]; then + git checkout main + git merge "pr/$pr_num" -m "new label: $label" + git branch -d "pr/$pr_num" + gh pr comment $pr_num --body 'Thank you!' + fi fi