File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 3030 - name : Check Action was successfully dispatched
3131 id : dispatched
3232 run : |
33- set -x
3433 START=${{ steps.start.outputs.start_time }}
35- RUN_ID=$(curl -H "Accept: application/vnd.github+json" \
34+ RUN_ID=$(curl -s - H "Accept: application/vnd.github+json" \
3635 'https://api.github.com/repos/miykael/nipype_tutorial/actions/runs?created=>'${START}'&per_page=1' \
3736 | jq -r '.workflow_runs[0].id')
3837
@@ -42,13 +41,12 @@ jobs:
4241 - name : Check if action completed
4342 timeout-minutes : 120
4443 run : |
45- set -x
4644 RUN_ID=${{ steps.dispatched.outputs.run_id }}
4745 while :
4846 do
4947 TIMESTAMP=$(date +'%Y-%m-%dT%H:%M:%S%z')
5048 # check status every 5 minutes
51- STATUS=$(curl -H "Accept: application/vnd.github+json" \
49+ STATUS=$(curl -s - H "Accept: application/vnd.github+json" \
5250 https://api.github.com/repos/miykael/nipype_tutorial/actions/runs/${RUN_ID} \
5351 | jq -r '.conclusion')
5452 case $STATUS in
6563 sleep 300
6664 esac
6765 done
66+ - name : Cancel ongoing run if cancelled or failed
67+ if : ${{ failure() || cancelled() }}
68+ run : |
69+ set -x
70+ RUN_ID=${{ steps.dispatched.outputs.run_id }}
71+ echo "Something went wrong, cancelling dispatched run"
72+ curl -s -X POST \
73+ -H "Accept: application/vnd.github+json" \
74+ -H "Authorization: Bearer ${{ secrets.TUTORIAL_ACCESS_TOKEN }}" \
75+ https://api.github.com/repos/miykael/nipype_tutorial/actions/runs/${RUN_ID}/cancel
You can’t perform that action at this time.
0 commit comments