1
1
#! /bin/bash
2
- IDF_REPO=" https://github.com/espressif/esp-idf.git"
3
- IDF_BRANCH=" release/v3.2"
2
+
4
3
IDF_COMPS=" $IDF_PATH /components"
5
4
IDF_TOOLCHAIN=" xtensa-esp32-elf"
6
5
IDF_TOOLCHAIN_LINUX_ARMEL=" https://dl.espressif.com/dl/xtensa-esp32-elf-linux-armel-1.22.0-87-gb57bad3-5.2.0.tar.gz"
@@ -9,10 +8,25 @@ IDF_TOOLCHAIN_LINUX64="https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22
9
8
IDF_TOOLCHAIN_WIN32=" https://dl.espressif.com/dl/xtensa-esp32-elf-win32-1.22.0-80-g6c4433a-5.2.0.zip"
10
9
IDF_TOOLCHAIN_MACOS=" https://dl.espressif.com/dl/xtensa-esp32-elf-osx-1.22.0-80-g6c4433a-5.2.0.tar.gz"
11
10
12
- CAMERA_REPO=" https://github.com/espressif/esp32-camera.git"
13
- FACE_REPO=" https://github.com/espressif/esp-face.git"
11
+ if [ -z $IDF_BRANCH ]; then
12
+ IDF_BRANCH=" release/v3.2"
13
+ fi
14
+
15
+ # Owner of the target ESP32 Arduino repository
16
+ AR_USER=" me-no-dev"
17
+
18
+ # The full name of the repository
19
+ AR_REPO=" $AR_USER /arduino-esp32"
20
+
21
+ IDF_REPO_URL=" https://github.com/espressif/esp-idf.git"
22
+ CAMERA_REPO_URL=" https://github.com/espressif/esp32-camera.git"
23
+ FACE_REPO_URL=" https://github.com/espressif/esp-face.git"
24
+ AR_REPO_URL=" https://github.com/$AR_REPO .git"
25
+
26
+ if [ -n $GITHUB_TOKEN ]; then
27
+ AR_REPO_URL=" https://$GITHUB_TOKEN @github.com/$AR_REPO .git"
28
+ fi
14
29
15
- AR_REPO=" https://github.com/espressif/arduino-esp32.git"
16
30
AR_ROOT=" $PWD "
17
31
AR_COMPS=" $AR_ROOT /components"
18
32
AR_OUT=" $AR_ROOT /out"
@@ -56,3 +70,38 @@ if [[ "$AR_OS" == "macos" ]]; then
56
70
export SED=" gsed"
57
71
export SSTAT=" stat -f %z"
58
72
fi
73
+
74
+ function git_commit_exists(){ # git_commit_exists <repo-path> <commit-message>
75
+ local repo_path=" $1 "
76
+ local commit_message=" $2 "
77
+ local commits_found=` git -C " $repo_path " log --all --grep=" $commit_message " | grep commit`
78
+ if [ -n " $commits_found " ]; then echo 1; else echo 0; fi
79
+ }
80
+
81
+ function git_branch_exists(){ # git_branch_exists <repo-path> <branch-name>
82
+ local repo_path=" $1 "
83
+ local branch_name=" $2 "
84
+ local branch_found=` git -C " $repo_path " ls-remote --heads origin " $branch_name " `
85
+ if [ -n " $branch_found " ]; then echo 1; else echo 0; fi
86
+ }
87
+
88
+ function git_pr_exists(){ # git_pr_exists <branch-name>
89
+ local pr_num=` curl -s -k -H " Authorization: token $GITHUB_TOKEN " -H " Accept: application/vnd.github.v3.raw+json" " https://api.github.com/repos/$AR_REPO /pulls?head=$AR_USER :$1 &state=open" | jq -r ' .[].number' `
90
+ if [ ! " $pr_num " == " " ] && [ ! " $pr_num " == " null" ]; then echo 1; else echo 0; fi
91
+ }
92
+
93
+ function git_create_pr(){ # git_create_pr <branch> <title>
94
+ local pr_branch=" $1 "
95
+ local pr_title=" $2 "
96
+ local pr_body=" "
97
+ for component in ` ls " $AR_COMPS " ` ; do
98
+ if [ ! $component == " arduino" ] && [ -d " $AR_COMPS /$component /.git" ]; then
99
+ pr_body+=" $component : " $( git -C " $AR_COMPS /$component " symbolic-ref --short HEAD) " " $( git -C " $AR_COMPS /$component " rev-parse --short HEAD) " \r\n"
100
+ fi
101
+ done
102
+ local pr_data=" {\" title\" : \" $pr_title \" , \" body\" : \" $pr_body \" , \" head\" : \" $AR_USER :$pr_branch \" , \" base\" : \" master\" }"
103
+ 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" `
104
+ local done_pr=` echo " $git_create_pr_res " | jq -r ' .title' `
105
+ if [ ! " $done_pr " == " " ] && [ ! " $done_pr " == " null" ]; then echo 1; else echo 0; fi
106
+ }
107
+
0 commit comments