From 7b12161f525338410b7a698eb2dd55d5e0429daa Mon Sep 17 00:00:00 2001 From: Remy Willems Date: Tue, 9 Jan 2024 01:15:56 +0100 Subject: [PATCH] Fix bug in check deep tests script (#4941) ### Description - Fix the nightly build check so it fails if the last completed build was a failure or timed out. ### How has this been tested? - Read the code twice - I will do a manual test once this is merged By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt). --- .../workflows/check-deep-tests-reusable.yml | 1 + .github/workflows/check-for-workflow-run.js | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-deep-tests-reusable.yml b/.github/workflows/check-deep-tests-reusable.yml index 72996ae803..eb38ecebc9 100644 --- a/.github/workflows/check-deep-tests-reusable.yml +++ b/.github/workflows/check-deep-tests-reusable.yml @@ -1,6 +1,7 @@ name: Check Deep Tests (Reusable Workflow) on: + workflow_dispatch: workflow_call: jobs: diff --git a/.github/workflows/check-for-workflow-run.js b/.github/workflows/check-for-workflow-run.js index 1b0b3d8490..ced1918289 100644 --- a/.github/workflows/check-for-workflow-run.js +++ b/.github/workflows/check-for-workflow-run.js @@ -16,13 +16,18 @@ module.exports = async ({github, context, core, workflow_id, sha, ...config}) => const runFilterDesc = sha ? `${workflow_id} on ${sha}` : workflow_id for (const run of result.data.workflow_runs) { if ((!sha || run.head_sha === sha)) { - if (run.conclusion === "success") { - // The SHA is fully tested, exit with success - console.log(`Last run of ${runFilterDesc} succeeded: ${run.html_url}`) - return - } else if (run.status === "failure" || run.status === "timed_out") { - core.setFailed(`Last run of ${runFilterDesc} did not succeed: ${run.html_url}`) - return + // The status property can be one of: “queued”, “in_progress”, or “completed”. + if (run.status === "completed") { + // The conclusion property can be one of: + // “success”, “failure”, “neutral”, “cancelled”, “skipped”, “timed_out”, or “action_required”. + if (run.conclusion === "success") { + // The SHA is fully tested, exit with success + console.log(`Last run of ${runFilterDesc} succeeded: ${run.html_url}`) + return + } else if (run.conclusion === "failure" || run.conclusion === "timed_out") { + core.setFailed(`Last run of ${runFilterDesc} did not succeed: ${run.html_url}`) + return + } } } }