Skip to content

Commit 6f8f427

Browse files
erd0sdawidd6
andauthored
Fix octokit returning weird results from listWorkflowRuns (#95)
Closes: #93 Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
1 parent 04e29e0 commit 6f8f427

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

main.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,24 @@ async function main() {
6363
workflow_id: workflow,
6464
branch: branch,
6565
event: event,
66-
status: workflowConclusion,
6766
}
6867
)) {
69-
const run = runs.data.find(r => {
70-
if (commit) {
71-
return r.head_sha == commit
68+
for (const run of runs.data) {
69+
if (commit && run.head_sha != commit) {
70+
continue
7271
}
73-
if (runNumber) {
74-
return r.run_number == runNumber
72+
if (runNumber && run.run_number != runNumber) {
73+
continue
74+
}
75+
if (workflowConclusion && (workflowConclusion != run.conclusion && workflowConclusion != run.status)) {
76+
continue
7577
}
76-
return true
77-
})
78-
79-
if (run) {
8078
runID = run.id
8179
break
8280
}
81+
if (runID) {
82+
break
83+
}
8384
}
8485
}
8586

0 commit comments

Comments
 (0)