Skip to content

Commit fe8eeb0

Browse files
committed
Add option to specify which Arduino branch will be target for PR
1 parent 9036908 commit fe8eeb0

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

tools/config.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ if [ -z $IDF_BRANCH ]; then
1212
IDF_BRANCH="release/v3.3"
1313
fi
1414

15+
if [ -z $AR_PR_TARGET_BRANCH ]; then
16+
AR_PR_TARGET_BRANCH="release/v1.0"
17+
fi
18+
1519
# Owner of the target ESP32 Arduino repository
1620
AR_USER="espressif"
1721

@@ -96,13 +100,14 @@ function git_pr_exists(){ # git_pr_exists <branch-name>
96100
function git_create_pr(){ # git_create_pr <branch> <title>
97101
local pr_branch="$1"
98102
local pr_title="$2"
103+
local pr_target="$3"
99104
local pr_body=""
100105
for component in `ls "$AR_COMPS"`; do
101106
if [ ! $component == "arduino" ] && [ -d "$AR_COMPS/$component/.git" ]; then
102107
pr_body+="$component: "$(git -C "$AR_COMPS/$component" symbolic-ref --short HEAD)" "$(git -C "$AR_COMPS/$component" rev-parse --short HEAD)"\r\n"
103108
fi
104109
done
105-
local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"master\"}"
110+
local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}"
106111
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"`
107112
local done_pr=`echo "$git_create_pr_res" | jq -r '.title'`
108113
if [ ! "$done_pr" == "" ] && [ ! "$done_pr" == "null" ]; then echo 1; else echo 0; fi

tools/push-to-arduino.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fi
5050
#
5151

5252
if [ "$AR_HAS_PR" == "0" ]; then
53-
pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE"`
53+
pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"`
5454
if [ $pr_created == "0" ]; then
5555
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'`
5656
exit 1

0 commit comments

Comments
 (0)