@@ -63,7 +63,7 @@ GITHUB_API_URL="https://api.github.com"
63
63
PER_PAGE=100
64
64
65
65
# Hard-coded list of core contributors:
66
- core_contributors=(" kgryte" " Planeshifter" " gunjjoshi" " headlessNode" )
66
+ core_contributors=(" kgryte" " Planeshifter" " gunjjoshi" " headlessNode" ) # TODO: resolve core contributors from one source of truth going forward
67
67
68
68
# Define a heartbeat interval to periodically print messages in order to prevent CI from prematurely ending a build due to long running commands:
69
69
heartbeat_interval=' 30s'
@@ -127,7 +127,7 @@ print_success() {
127
127
compute_since_date () {
128
128
if date --version > /dev/null 2>&1 ; then
129
129
# GNU date:
130
- date -u -d " $days days ago" +" %Y-%m-%dT%H:%M:%SZ"
130
+ date -u -d " ${ days} days ago" +" %Y-%m-%dT%H:%M:%SZ"
131
131
else
132
132
# macOS date:
133
133
date -u -v-" ${days} " d +" %Y-%m-%dT%H:%M:%SZ"
@@ -143,7 +143,7 @@ github_api() {
143
143
" -H" " Authorization: token ${github_token} " \
144
144
" -H" " Accept: application/vnd.github+json" )
145
145
146
- curl -s " ${headers[@]} " " $GITHUB_API_URL$ endpoint "
146
+ curl -s " ${headers[@]} " " ${ GITHUB_API_URL}${ endpoint} "
147
147
}
148
148
149
149
# Makes a GitHub API POST request.
@@ -158,25 +158,24 @@ github_api_post() {
158
158
" -H" " Accept: application/vnd.github+json" \
159
159
" -H" " Content-Type: application/json" )
160
160
161
- curl -s -X POST " ${headers[@]} " -d " $data " " $GITHUB_API_URL$ endpoint "
161
+ curl -s -X POST " ${headers[@]} " -d " ${ data} " " ${ GITHUB_API_URL}${ endpoint} "
162
162
}
163
163
164
164
# Creates a GitHub issue using the provided title and body.
165
- # The issue is tagged with the "Good First Issue" label.
166
165
#
167
166
# $1 - Issue title
168
167
# $2 - Issue body
169
168
create_issue () {
170
169
local title=" $1 "
171
170
local body=" $2 "
172
171
local payload
172
+ local response
173
173
174
174
# Build the JSON payload including the labels field:
175
- payload=$( jq -n --arg title " $title " --arg body " $body " \
175
+ payload=$( jq -n --arg title " ${ title} " --arg body " ${ body} " \
176
176
' {title: $title, body: $body, labels: ["Good First Issue"]}' )
177
177
178
178
local endpoint=" /repos/${owner} /${repo} /issues"
179
- local response
180
179
response=$( github_api_post " $endpoint " " $payload " )
181
180
182
181
if ! echo " $response " | jq . > /dev/null 2>&1 ; then
@@ -192,12 +191,12 @@ create_issue() {
192
191
issue_exists_for_commit () {
193
192
local commit_sha=" $1 "
194
193
local short_sha=${commit_sha: 0: 7}
194
+ local query
195
195
196
196
# Build a search query that looks for the commit short SHA in the issue title:
197
197
local raw_query=" repo:${owner} /${repo} in:title \" commit ${short_sha} \" "
198
198
199
199
# URL-encode the query using jq:
200
- local query
201
200
query=$( echo " $raw_query " | jq -sRr @uri)
202
201
203
202
local endpoint=" /search/issues?q=${query} "
0 commit comments