Skip to content

Commit

Permalink
fix: capturing build history for repo (#22)
Browse files Browse the repository at this point in the history
* fix: support repos without 500 builds

* fix: append builds after API call
  • Loading branch information
jbrockopp authored May 7, 2020
1 parent e15abb7 commit b607e0b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/vela-downstream/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ func (p *Plugin) Exec() error {
return fmt.Errorf("unable to list builds for %s: %w", repo.GetFullName(), err)
}

// break the loop after 5 pages of results
// giving us a total of 500 builds collected
if resp.NextPage > 5 {
break
}

// add the results to the list of builds
builds = append(builds, *b...)

// break the loop if there is no more results
// to page through or after 5 pages of results
// giving us up to a total of 500 builds
if resp.NextPage == 0 || resp.NextPage > 5 {
break
}

// update the options for listing builds
// to point at the next page
opts.Page = resp.NextPage
Expand Down

0 comments on commit b607e0b

Please sign in to comment.