File tree 1 file changed +57
-0
lines changed
1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Test tutorials
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - ' rel/*'
7
+
8
+ jobs :
9
+ tutorial :
10
+ runs-on : ubuntu-latest
11
+ env :
12
+ BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
13
+ steps :
14
+ - name : Start time
15
+ id : start
16
+ run : echo "::set-output name=start_time::$(date +'%Y-%m-%dT%H:%M:%S%z')"
17
+ - name : Trigger Nipype tutorial Github Action
18
+ run : |
19
+ curl -X POST \
20
+ -H "Authorization: Bearer ${{ secrets.TUTORIAL_ACCESS_TOKEN }}" \
21
+ -H "Accept: application/vnd.github+json" \
22
+ https://api.github.com/repos/miykael/nipype_tutorial/actions/workflows/testing.yml/dispatches \
23
+ -d '{"nipype_branch": "'${BRANCH_NAME:4}'"}'
24
+ - name : Check Action was successfully dispatched
25
+ id : dispatched
26
+ run : |
27
+ RUN_ID=$(curl -X POST \
28
+ -H "Accept: application/vnd.github+json" \
29
+ "https://api.github.com/repos/miykael/nipype_tutorial/actions/runs?created=>${{ steps.start.outputs.start_time }}&per_page=1" \
30
+ | jq -r '.workflow_runs[0].id')
31
+
32
+ # fail if not extracted
33
+ [[ -n $RUN_ID ]] || exit 1
34
+ echo "::set-output name=run_id::$RUN_ID""
35
+ - name : Check if action completed
36
+ timeout-minutes : 60
37
+ run : |
38
+ while :
39
+ do
40
+ TIMESTAMP=$(date +'%Y-%m-%dT%H:%M:%S%z')
41
+ # check status every 5 minutes
42
+ STATUS=$(curl -H "Accept: application/vnd.github+json" \
43
+ "https://api.github.com/repos/miykael/nipype_tutorial/actions/runs/${{ steps.dispatched.outputs.run_id }}" \
44
+ | jq -r '.conclusion')
45
+ case $STATUS in
46
+ success)
47
+ echo "[$TIMESTAMP] Tutorial run ${{ steps.dispatched.outputs.run_id }} completed successfully."
48
+ exit 0
49
+ ;;
50
+ failure)
51
+ echo "[$TIMESTAMP] Tutorial run ${{ steps.dispatched.outputs.run_id }} failed."
52
+ exit 1
53
+ ;;
54
+ *)
55
+ echo "[$TIMESTAMP] Conclusion ($STATUS) is not yet complete"
56
+ sleep 300
57
+ done
You can’t perform that action at this time.
0 commit comments