Skip to content

Commit

Permalink
build list uses API size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed Aug 7, 2020
1 parent 830856d commit 2064b97
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions drone/build/build_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func buildList(c *cli.Context) error {
return err
}

builds, err := client.BuildList(owner, name, drone.ListOptions{Page: c.Int("page")})
builds, err := client.BuildList(owner, name, drone.ListOptions{Page: c.Int("page"), Size: c.Int("limit")})
if err != nil {
return err
}
Expand All @@ -71,13 +71,8 @@ func buildList(c *cli.Context) error {
branch := c.String("branch")
event := c.String("event")
status := c.String("status")
limit := c.Int("limit")

var count int
for _, build := range builds {
if count >= limit {
break
}
if branch != "" && build.Target != branch {
continue
}
Expand All @@ -88,7 +83,6 @@ func buildList(c *cli.Context) error {
continue
}
tmpl.Execute(os.Stdout, build)
count++
}
return nil
}
Expand Down

0 comments on commit 2064b97

Please sign in to comment.