Skip to content

Commit 44d9e43

Browse files
committed
CI: Fix tutorial GHA
1 parent b0f07d0 commit 44d9e43

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
@@ -9,49 +9,55 @@ jobs:
99
tutorial:
1010
runs-on: ubuntu-latest
1111
env:
12-
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
12+
BRANCH_NAME: ${{ github.ref_name }}
1313
steps:
1414
- name: Start time
1515
id: start
1616
run: echo "::set-output name=start_time::$(date +'%Y-%m-%dT%H:%M:%S%z')"
1717
- name: Trigger Nipype tutorial Github Action
1818
run: |
19+
set -x
1920
curl -X POST \
2021
-H "Authorization: Bearer ${{ secrets.TUTORIAL_ACCESS_TOKEN }}" \
2122
-H "Accept: application/vnd.github+json" \
2223
https://api.github.com/repos/miykael/nipype_tutorial/actions/workflows/testing.yml/dispatches \
23-
-d '{"nipype_branch": "'${BRANCH_NAME:4}'"}'
24+
-d '{"ref": "master", "inputs": {"nipype_branch": "'${BRANCH_NAME}'"}}'
25+
sleep 10
2426
- name: Check Action was successfully dispatched
2527
id: dispatched
2628
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" \
29+
set -x
30+
START=${{ steps.start.outputs.start_time }}
31+
RUN_ID=$(curl -H "Accept: application/vnd.github+json" \
32+
'https://api.github.com/repos/miykael/nipype_tutorial/actions/runs?created=>'${START}'&per_page=1' \
3033
| jq -r '.workflow_runs[0].id')
3134
3235
# fail if not extracted
3336
[[ -n $RUN_ID ]] || exit 1
34-
echo "::set-output name=run_id::$RUN_ID""
37+
echo "::set-output name=run_id::$RUN_ID"
3538
- name: Check if action completed
36-
timeout-minutes: 60
39+
timeout-minutes: 120
3740
run: |
41+
set -x
42+
RUN_ID=${{ steps.dispatched.outputs.run_id }}
3843
while :
3944
do
4045
TIMESTAMP=$(date +'%Y-%m-%dT%H:%M:%S%z')
4146
# check status every 5 minutes
4247
STATUS=$(curl -H "Accept: application/vnd.github+json" \
43-
"https://api.github.com/repos/miykael/nipype_tutorial/actions/runs/${{ steps.dispatched.outputs.run_id }}" \
48+
https://api.github.com/repos/miykael/nipype_tutorial/actions/runs/${RUN_ID} \
4449
| jq -r '.conclusion')
4550
case $STATUS in
4651
success)
47-
echo "[$TIMESTAMP] Tutorial run ${{ steps.dispatched.outputs.run_id }} completed successfully."
52+
echo "[$TIMESTAMP] Tutorial run $RUN_ID completed successfully."
4853
exit 0
49-
;;
54+
;;
5055
failure)
51-
echo "[$TIMESTAMP] Tutorial run ${{ steps.dispatched.outputs.run_id }} failed."
56+
echo "[$TIMESTAMP] Tutorial run $RUN_ID failed."
5257
exit 1
53-
;;
58+
;;
5459
*)
5560
echo "[$TIMESTAMP] Conclusion ($STATUS) is not yet complete"
5661
sleep 300
62+
esac
5763
done

0 commit comments

Comments
 (0)