Skip to content

Commit 5178887

Browse files
mgxdeffigies
authored andcommitted
CI: Fix tutorial GHA
1 parent 0e38329 commit 5178887

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

.github/workflows/tutorials.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,55 @@ jobs:
1313
tutorial:
1414
runs-on: ubuntu-latest
1515
env:
16-
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
16+
BRANCH_NAME: ${{ github.ref_name }}
1717
steps:
1818
- name: Start time
1919
id: start
2020
run: echo "::set-output name=start_time::$(date +'%Y-%m-%dT%H:%M:%S%z')"
2121
- name: Trigger Nipype tutorial Github Action
2222
run: |
23+
set -x
2324
curl -X POST \
2425
-H "Authorization: Bearer ${{ secrets.TUTORIAL_ACCESS_TOKEN }}" \
2526
-H "Accept: application/vnd.github+json" \
2627
https://api.github.com/repos/miykael/nipype_tutorial/actions/workflows/testing.yml/dispatches \
27-
-d '{"nipype_branch": "'${BRANCH_NAME:4}'"}'
28+
-d '{"ref": "master", "inputs": {"nipype_branch": "'${BRANCH_NAME}'"}}'
29+
sleep 10
2830
- name: Check Action was successfully dispatched
2931
id: dispatched
3032
run: |
31-
RUN_ID=$(curl -X POST \
32-
-H "Accept: application/vnd.github+json" \
33-
"https://api.github.com/repos/miykael/nipype_tutorial/actions/runs?created=>${{ steps.start.outputs.start_time }}&per_page=1" \
33+
set -x
34+
START=${{ steps.start.outputs.start_time }}
35+
RUN_ID=$(curl -H "Accept: application/vnd.github+json" \
36+
'https://api.github.com/repos/miykael/nipype_tutorial/actions/runs?created=>'${START}'&per_page=1' \
3437
| jq -r '.workflow_runs[0].id')
3538
3639
# fail if not extracted
3740
[[ -n $RUN_ID ]] || exit 1
38-
echo "::set-output name=run_id::$RUN_ID""
41+
echo "::set-output name=run_id::$RUN_ID"
3942
- name: Check if action completed
40-
timeout-minutes: 60
43+
timeout-minutes: 120
4144
run: |
45+
set -x
46+
RUN_ID=${{ steps.dispatched.outputs.run_id }}
4247
while :
4348
do
4449
TIMESTAMP=$(date +'%Y-%m-%dT%H:%M:%S%z')
4550
# check status every 5 minutes
4651
STATUS=$(curl -H "Accept: application/vnd.github+json" \
47-
"https://api.github.com/repos/miykael/nipype_tutorial/actions/runs/${{ steps.dispatched.outputs.run_id }}" \
52+
https://api.github.com/repos/miykael/nipype_tutorial/actions/runs/${RUN_ID} \
4853
| jq -r '.conclusion')
4954
case $STATUS in
5055
success)
51-
echo "[$TIMESTAMP] Tutorial run ${{ steps.dispatched.outputs.run_id }} completed successfully."
56+
echo "[$TIMESTAMP] Tutorial run $RUN_ID completed successfully."
5257
exit 0
53-
;;
58+
;;
5459
failure)
55-
echo "[$TIMESTAMP] Tutorial run ${{ steps.dispatched.outputs.run_id }} failed."
60+
echo "[$TIMESTAMP] Tutorial run $RUN_ID failed."
5661
exit 1
57-
;;
62+
;;
5863
*)
5964
echo "[$TIMESTAMP] Conclusion ($STATUS) is not yet complete"
6065
sleep 300
66+
esac
6167
done

0 commit comments

Comments
 (0)