@@ -25,7 +25,7 @@ if [ -z $IDF_TARGET ]; then
25
25
fi
26
26
27
27
# Owner of the target ESP32 Arduino repository
28
- AR_USER=" espressif "
28
+ AR_USER=" $GITHUB_REPOSITORY_OWNER "
29
29
30
30
# The full name of the repository
31
31
AR_REPO=" $AR_USER /arduino-esp32"
@@ -99,12 +99,51 @@ if [[ "$AR_OS" == "macos" ]]; then
99
99
export SSTAT=" stat -f %z"
100
100
fi
101
101
102
+ function github_get_libs_idf(){ # github_get_libs_idf <repo-path> <branch-name> <message-prefix>
103
+ local repo_path=" $1 "
104
+ local branch_name=" $2 "
105
+ local message_prefix=" $3 "
106
+ message_prefix=$( echo $message_prefix | sed ' s/[]\/$*.^|[]/\\&/g' ) # Escape special characters
107
+ local page=1
108
+ local version_found=" "
109
+ local libs_version=" "
110
+
111
+ while [ " $libs_version " == " " ]; do
112
+ version_found=` curl -s -k -H " Authorization: token $GITHUB_TOKEN " -H " Accept: application/vnd.github.v3.raw+json" " https://api.github.com/repos/$repo_path /commits?sha=$branch_name &per_page=100&page=$page " | jq -r ' .[].commit.message' | grep -Eo " $message_prefix [a-f0-9]{8}" | awk ' NR==1{print $NF}' `
113
+ if [ ! " $version_found " == " " ] && [ ! " $version_found " == " null" ]; then
114
+ libs_version=$version_found
115
+ else
116
+ page=$(( page+ 1 ))
117
+ fi
118
+ done
119
+
120
+ if [ ! " $libs_version " == " " ] && [ ! " $libs_version " == " null" ]; then echo $libs_version ; else echo " " ; fi
121
+ }
122
+
102
123
function github_commit_exists(){ # github_commit_exists <repo-path> <branch-name> <commit-message>
103
124
local repo_path=" $1 "
104
125
local branch_name=" $2 "
105
126
local commit_message=" $3 "
106
- local commits_found=` curl -s -k -H " Authorization: token $GITHUB_TOKEN " -H " Accept: application/vnd.github.v3.raw+json" " https://api.github.com/repos/$repo_path /commits?sha=$branch_name " | jq -r ' .[].commit.message' | grep " $commit_message " | wc -l`
107
- if [ ! " $commits_found " == " " ] && [ ! " $commits_found " == " null" ] && [ ! " $commits_found " == " 0" ]; then echo $commits_found ; else echo 0; fi
127
+ local page=1
128
+ local commits_found=0
129
+
130
+ while true ; do
131
+ local response=` curl -s -k -H " Authorization: token $GITHUB_TOKEN " -H " Accept: application/vnd.github.v3.raw+json" " https://api.github.com/repos/$repo_path /commits?sha=$branch_name &per_page=100&page=$page " `
132
+
133
+ if [[ -z " $response " || " $response " == " []" ]]; then
134
+ break
135
+ fi
136
+
137
+ local commits=` echo " $response " | jq -r ' .[].commit.message' | grep " $commit_message " | wc -l`
138
+ if [ " $commits " -gt 0 ]; then
139
+ commits_found=1
140
+ break
141
+ fi
142
+
143
+ page=$(( page+ 1 ))
144
+ done
145
+
146
+ echo $commits_found
108
147
}
109
148
110
149
function github_last_commit(){ # github_last_commit <repo-path> <branch-name>
0 commit comments