Skip to content

Commit

Permalink
Fix bug in check deep tests script (#4941)
Browse files Browse the repository at this point in the history
### 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

<small>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).</small>
  • Loading branch information
keyboardDrummer authored Jan 9, 2024
1 parent d29e234 commit 7b12161
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/check-deep-tests-reusable.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Check Deep Tests (Reusable Workflow)

on:
workflow_dispatch:
workflow_call:

jobs:
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/check-for-workflow-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Expand Down

0 comments on commit 7b12161

Please sign in to comment.