From 8e1666b05a9c066bf46d1d91901e7952490ee0ae Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Thu, 19 May 2022 02:19:12 +0300 Subject: [PATCH] Fix errors: - propose only open PRs from gitea - use ssh_url - both repos should have ssh urls - exit if pull failed --- files/gitea-merge.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/gitea-merge.sh b/files/gitea-merge.sh index 5f5cb15..02e3c09 100755 --- a/files/gitea-merge.sh +++ b/files/gitea-merge.sh @@ -11,13 +11,13 @@ fi if [ -z "${2}" ]; then echo "No PR# specified, here is a list:" curl -s --request GET -u ${1} ${REPOAPIURL}/pulls \ - | jq '.[] | .number, .title' | paste - - + | jq '.[] | select(.state == "open") | .number, .title' | paste - - exit 1 fi pr=$(curl -s --request GET -u ${1} ${REPOAPIURL}/pulls/${2}) -branch=$(echo $pr | jq '.head | (.repo.clone_url + " " + .label)' | tr -d '"') +branch=$(echo $pr | jq '.head | (.repo.ssh_url + " " + .label)' | tr -d '"') title=$(echo $pr | jq '.title') body=$(echo $pr | jq '.body') @@ -25,7 +25,7 @@ body=$(echo $pr | jq '.body') echo "Merging PR ${2}" git checkout -b gitea-${2} v0.6 -git pull ${branch} +git pull ${branch} || exit 1 git push --set-upstream origin gitea-${2} if [ -z "${3}" ]; then