diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-01-20 12:17:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-20 20:17:58 +0800 |
commit | 018e0350f8e92205c894a249a978dbe5464483ec (patch) | |
tree | 52fe2ce2e135ef30c4a3844136853000965b17eb | |
parent | d37ee4d41c70aa309550e7337f75126ef2932c62 (diff) | |
download | tracifyjs-018e0350f8e92205c894a249a978dbe5464483ec.tar.gz tracifyjs-018e0350f8e92205c894a249a978dbe5464483ec.zip |
workaround GitHub Actions bug (#4573)
-rw-r--r-- | test/ufuzz/actions.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/ufuzz/actions.js b/test/ufuzz/actions.js index 7e9dc21c..ac494940 100644 --- a/test/ufuzz/actions.js +++ b/test/ufuzz/actions.js @@ -10,16 +10,17 @@ exports.init = function(url, auth, num) { exports.should_stop = function(callback) { read(base + "/actions/runs?per_page=100", function(reply) { if (!reply || !Array.isArray(reply.workflow_runs)) return; - var runs = reply.workflow_runs.filter(function(workflow) { - return workflow.status != "completed"; - }).sort(function(a, b) { + var runs = reply.workflow_runs.sort(function(a, b) { return b.run_number - a.run_number; }); var found = false, remaining = 20; (function next() { - if (!runs.length) return; - var workflow = runs.pop(); - if (workflow.event == "schedule" && workflow.run_number == run_number) found = true; + var workflow; + do { + workflow = runs.pop(); + if (!workflow) return; + if (workflow.event == "schedule" && workflow.run_number == run_number) found = true; + } while (!found && workflow.status == "completed"); read(workflow.jobs_url, function(reply) { if (!reply || !Array.isArray(reply.jobs)) return; if (!reply.jobs.every(function(job) { |