@@ -186,6 +186,40 @@ jobs:
186
186
- run : mkdir -p workspace
187
187
- install-gh-cli
188
188
189
+ - run :
190
+ name : Get Github pull-request number
191
+ command : |
192
+ set +e
193
+ gh pr view --json number,state,title,url > gh-pull-data.json
194
+ for ((x=0 ; x<5 ; x++)) ; do
195
+ if [ -z $(cat gh-pull-data.json | jq -r '.number') ] ; then
196
+ gh pr view --json number,state,title,url > gh-pull-data.json
197
+ else
198
+ echo "» Pull-request #"$(cat gh-pull-data.json | jq -r '.number')
199
+ break
200
+ fi
201
+ done
202
+ echo
203
+ echo "=== Github pull-request API results ==="
204
+ cat gh-pull-data.json
205
+ echo "---------------------------------------"
206
+ cat gh-pull-data.json | jq -r '.number' > workspace/gh-pr-num.txt && cat workspace/gh-pr-num.txt
207
+
208
+ - run :
209
+ name : Verify Github pull-request number
210
+ command : |
211
+ echo "» Branch: "${CIRCLE_BRANCH}
212
+ echo
213
+ if [[ ${CIRCLECI_BRANCH} =~ ^\d{3}-(summer|spring|winter)-\d{2}$ ]] ; then
214
+ echo "» Does not require a pull-request number"
215
+ else
216
+ if [ -z $(cat workspace/gh-pr-num.txt) ] ; then
217
+ echo "» No pull-request number found!"
218
+ echo "» Please try running this CI workflow again."
219
+ exit 1
220
+ fi
221
+ fi
222
+
189
223
- run :
190
224
name : Retrieve Github deployments
191
225
command : |
@@ -199,16 +233,6 @@ jobs:
199
233
gh api ${STATUS_URL} -f state=in_progress -H "Accept: application/vnd.github.flash-preview+json"
200
234
done
201
235
202
- - run :
203
- name : Get Github pull-request number
204
- command : |
205
- set +e
206
- gh pr view --json number,state,title,url > gh-pull-data.json
207
- echo "=== Github pull-request API results ==="
208
- cat gh-pull-data.json
209
- echo "---------------------------------------"
210
- cat gh-pull-data.json | jq -r '.number' > workspace/gh-pr-num.txt && cat workspace/gh-pr-num.txt
211
-
212
236
- persist_to_workspace :
213
237
root : workspace
214
238
paths :
0 commit comments