Skip to content

Commit

Permalink
Workaround GH api break around filtering runs by status (#37)
Browse files Browse the repository at this point in the history
* Workaround GH api break around filtering runs by status

* Add missing assets

* More workaround github api break
  • Loading branch information
viveklak committed May 5, 2023
1 parent 59bbf83 commit c811a7c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ dist/
lib/
node_modules/
jest.config.js
__tests__/
18 changes: 6 additions & 12 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

19 changes: 6 additions & 13 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,15 @@ export async function run(opts: RunOpts): Promise<void> {
branch
},
(response, done) => {
let res = response.data.workflow_runs
if (opts.status) {
if (response.data.workflow_runs) {
res = response.data.workflow_runs.filter(
resp => resp.status === opts.status
)
} else {
res = []
const res = response.data.filter(resp => resp.status === opts.status)
// Don't actually want to look through all the runs - if we find some matching the status, lets return
if (res.length > 0) {
done()
return res
}
}
// Don't actually want to look through all the runs - if we find some matching the status, lets return
//
if (res.length > 0) {
done()
}
return res
return response.data
}
)

Expand Down

0 comments on commit c811a7c

Please sign in to comment.