From fe8eeb0cabef4d34ccf66c22dc3d3fd143b096be Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Mon, 5 Apr 2021 13:56:01 +0300 Subject: [PATCH] Add option to specify which Arduino branch will be target for PR --- tools/config.sh | 7 ++++++- tools/push-to-arduino.sh | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/config.sh b/tools/config.sh index 686bade..a82151c 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -12,6 +12,10 @@ if [ -z $IDF_BRANCH ]; then IDF_BRANCH="release/v3.3" fi +if [ -z $AR_PR_TARGET_BRANCH ]; then + AR_PR_TARGET_BRANCH="release/v1.0" +fi + # Owner of the target ESP32 Arduino repository AR_USER="espressif" @@ -96,13 +100,14 @@ function git_pr_exists(){ # git_pr_exists function git_create_pr(){ # git_create_pr local pr_branch="$1" local pr_title="$2" + local pr_target="$3" local pr_body="" for component in `ls "$AR_COMPS"`; do if [ ! $component == "arduino" ] && [ -d "$AR_COMPS/$component/.git" ]; then pr_body+="$component: "$(git -C "$AR_COMPS/$component" symbolic-ref --short HEAD)" "$(git -C "$AR_COMPS/$component" rev-parse --short HEAD)"\r\n" fi done - local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"master\"}" + local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}" git_create_pr_res=`echo "$pr_data" | curl -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" --data @- "https://api.github.com/repos/$AR_REPO/pulls"` local done_pr=`echo "$git_create_pr_res" | jq -r '.title'` if [ ! "$done_pr" == "" ] && [ ! "$done_pr" == "null" ]; then echo 1; else echo 0; fi diff --git a/tools/push-to-arduino.sh b/tools/push-to-arduino.sh index 7ebb077..17a0845 100755 --- a/tools/push-to-arduino.sh +++ b/tools/push-to-arduino.sh @@ -50,7 +50,7 @@ fi # if [ "$AR_HAS_PR" == "0" ]; then - pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE"` + pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"` if [ $pr_created == "0" ]; then echo "ERROR: Failed to create PR '$AR_NEW_PR_TITLE': "`echo "$git_create_pr_res" | jq -r '.message'`": "`echo "$git_create_pr_res" | jq -r '.errors[].message'` exit 1