Add option to specify which Arduino branch will be target for PR
This commit is contained in:
parent
9036908331
commit
fe8eeb0cab
2 changed files with 7 additions and 2 deletions
|
|
@ -12,6 +12,10 @@ if [ -z $IDF_BRANCH ]; then
|
||||||
IDF_BRANCH="release/v3.3"
|
IDF_BRANCH="release/v3.3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z $AR_PR_TARGET_BRANCH ]; then
|
||||||
|
AR_PR_TARGET_BRANCH="release/v1.0"
|
||||||
|
fi
|
||||||
|
|
||||||
# Owner of the target ESP32 Arduino repository
|
# Owner of the target ESP32 Arduino repository
|
||||||
AR_USER="espressif"
|
AR_USER="espressif"
|
||||||
|
|
||||||
|
|
@ -96,13 +100,14 @@ function git_pr_exists(){ # git_pr_exists <branch-name>
|
||||||
function git_create_pr(){ # git_create_pr <branch> <title>
|
function git_create_pr(){ # git_create_pr <branch> <title>
|
||||||
local pr_branch="$1"
|
local pr_branch="$1"
|
||||||
local pr_title="$2"
|
local pr_title="$2"
|
||||||
|
local pr_target="$3"
|
||||||
local pr_body=""
|
local pr_body=""
|
||||||
for component in `ls "$AR_COMPS"`; do
|
for component in `ls "$AR_COMPS"`; do
|
||||||
if [ ! $component == "arduino" ] && [ -d "$AR_COMPS/$component/.git" ]; then
|
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"
|
pr_body+="$component: "$(git -C "$AR_COMPS/$component" symbolic-ref --short HEAD)" "$(git -C "$AR_COMPS/$component" rev-parse --short HEAD)"\r\n"
|
||||||
fi
|
fi
|
||||||
done
|
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"`
|
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'`
|
local done_pr=`echo "$git_create_pr_res" | jq -r '.title'`
|
||||||
if [ ! "$done_pr" == "" ] && [ ! "$done_pr" == "null" ]; then echo 1; else echo 0; fi
|
if [ ! "$done_pr" == "" ] && [ ! "$done_pr" == "null" ]; then echo 1; else echo 0; fi
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ fi
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ "$AR_HAS_PR" == "0" ]; then
|
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
|
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'`
|
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
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue