@@ -13,49 +13,55 @@ jobs:
13
13
tutorial :
14
14
runs-on : ubuntu-latest
15
15
env :
16
- BRANCH_NAME : ${{ github.head_ref || github. ref_name }}
16
+ BRANCH_NAME : ${{ github.ref_name }}
17
17
steps :
18
18
- name : Start time
19
19
id : start
20
20
run : echo "::set-output name=start_time::$(date +'%Y-%m-%dT%H:%M:%S%z')"
21
21
- name : Trigger Nipype tutorial Github Action
22
22
run : |
23
+ set -x
23
24
curl -X POST \
24
25
-H "Authorization: Bearer ${{ secrets.TUTORIAL_ACCESS_TOKEN }}" \
25
26
-H "Accept: application/vnd.github+json" \
26
27
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
28
30
- name : Check Action was successfully dispatched
29
31
id : dispatched
30
32
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' \
34
37
| jq -r '.workflow_runs[0].id')
35
38
36
39
# fail if not extracted
37
40
[[ -n $RUN_ID ]] || exit 1
38
- echo "::set-output name=run_id::$RUN_ID""
41
+ echo "::set-output name=run_id::$RUN_ID"
39
42
- name : Check if action completed
40
- timeout-minutes : 60
43
+ timeout-minutes : 120
41
44
run : |
45
+ set -x
46
+ RUN_ID=${{ steps.dispatched.outputs.run_id }}
42
47
while :
43
48
do
44
49
TIMESTAMP=$(date +'%Y-%m-%dT%H:%M:%S%z')
45
50
# check status every 5 minutes
46
51
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} \
48
53
| jq -r '.conclusion')
49
54
case $STATUS in
50
55
success)
51
- echo "[$TIMESTAMP] Tutorial run ${{ steps.dispatched.outputs.run_id }} completed successfully."
56
+ echo "[$TIMESTAMP] Tutorial run $RUN_ID completed successfully."
52
57
exit 0
53
- ;;
58
+ ;;
54
59
failure)
55
- echo "[$TIMESTAMP] Tutorial run ${{ steps.dispatched.outputs.run_id }} failed."
60
+ echo "[$TIMESTAMP] Tutorial run $RUN_ID failed."
56
61
exit 1
57
- ;;
62
+ ;;
58
63
*)
59
64
echo "[$TIMESTAMP] Conclusion ($STATUS) is not yet complete"
60
65
sleep 300
66
+ esac
61
67
done
0 commit comments