From 3a8197fc45af8851ea41bdc445557e5b174cb3d7 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Wed, 21 Sep 2022 10:55:00 -0400 Subject: [PATCH 1/2] CI: Propagate abrupt stops to tutorial GHA run --- .github/workflows/tutorials.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/tutorials.yml b/.github/workflows/tutorials.yml index 055e247fe0..4aa5e08606 100644 --- a/.github/workflows/tutorials.yml +++ b/.github/workflows/tutorials.yml @@ -65,3 +65,13 @@ jobs: sleep 300 esac done + - name: Cancel ongoing run if cancelled or failed + if: ${{ failure() || cancelled() }} + run: | + set -x + RUN_ID=${{ steps.dispatched.outputs.run_id }} + echo "Something went wrong, cancelling dispatched run" + curl -s -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.TUTORIAL_ACCESS_TOKEN }}" \ + https://api.github.com/repos/miykael/nipype_tutorial/actions/runs/${RUN_ID}/cancel From 740bdc1845821ac110015cb2e309d5fd34032f38 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Wed, 21 Sep 2022 10:56:31 -0400 Subject: [PATCH 2/2] CI: Reduce stdout pollution --- .github/workflows/tutorials.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tutorials.yml b/.github/workflows/tutorials.yml index 4aa5e08606..4f80942d17 100644 --- a/.github/workflows/tutorials.yml +++ b/.github/workflows/tutorials.yml @@ -30,9 +30,8 @@ jobs: - name: Check Action was successfully dispatched id: dispatched run: | - set -x START=${{ steps.start.outputs.start_time }} - RUN_ID=$(curl -H "Accept: application/vnd.github+json" \ + RUN_ID=$(curl -s -H "Accept: application/vnd.github+json" \ 'https://api.github.com/repos/miykael/nipype_tutorial/actions/runs?created=>'${START}'&per_page=1' \ | jq -r '.workflow_runs[0].id') @@ -42,13 +41,12 @@ jobs: - name: Check if action completed timeout-minutes: 120 run: | - set -x RUN_ID=${{ steps.dispatched.outputs.run_id }} while : do TIMESTAMP=$(date +'%Y-%m-%dT%H:%M:%S%z') # check status every 5 minutes - STATUS=$(curl -H "Accept: application/vnd.github+json" \ + STATUS=$(curl -s -H "Accept: application/vnd.github+json" \ https://api.github.com/repos/miykael/nipype_tutorial/actions/runs/${RUN_ID} \ | jq -r '.conclusion') case $STATUS in