From 6e9e5ec8552c6babc4edd612503aaa8149ce647e Mon Sep 17 00:00:00 2001 From: "James M. Greene" Date: Fri, 24 Sep 2021 15:51:04 -0500 Subject: [PATCH] Correctly drill down to 'jobs' array (#21732) --- .github/workflows/staging-deploy-pr.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/staging-deploy-pr.yml b/.github/workflows/staging-deploy-pr.yml index bcba453acd..23c21af89d 100644 --- a/.github/workflows/staging-deploy-pr.yml +++ b/.github/workflows/staging-deploy-pr.yml @@ -52,15 +52,18 @@ jobs: with: script: | const { owner, repo } = context.repo - const { data: buildJobs } = await github.actions.listJobsForWorkflowRun({ + const { data: { jobs: buildJobs } } = await github.actions.listJobsForWorkflowRun({ owner, repo, run_id: process.env.BUILD_RUN_ID, filter: 'latest' }) - const wasCancelled = buildJobs.every(({ status, conclusion }) => { - return status === 'completed' && conclusion === 'cancelled' - }) + const wasCancelled = ( + buildJobs.length > 0 && + buildJobs.every(({ status, conclusion }) => { + return status === 'completed' && conclusion === 'cancelled' + }) + ) core.setOutput('cancelled', wasCancelled.toString()) - if: ${{ steps.check-workflow-run.outputs.cancelled == 'false' }}