Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Workaround GH api break around filtering runs by status #37

Merged
merged 3 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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