1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-02-05 13:25:19 +02:00

fix(githubPublishRelease): ListByRepo - enable pagination (#4509)

* fix githubPublishRelease

---------

Co-authored-by: Egor Balakin <egor.balakin@sap.com>
This commit is contained in:
Egor Balakin 2023-08-22 11:45:54 +04:00 committed by GitHub
parent d6d3b6b091
commit 143c5b0bc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -115,9 +115,19 @@ func getClosedIssuesText(ctx context.Context, publishedAt github.Timestamp, conf
if len(config.Labels) > 0 {
options.Labels = config.Labels
}
ghIssues, _, err := ghIssueClient.ListByRepo(ctx, config.Owner, config.Repository, &options)
if err != nil {
log.Entry().WithError(err).Error("Failed to get GitHub issues.")
var ghIssues []*github.Issue
for {
issues, resp, err := ghIssueClient.ListByRepo(ctx, config.Owner, config.Repository, &options)
if err != nil {
log.Entry().WithError(err).Error("failed to get GitHub issues")
}
ghIssues = append(ghIssues, issues...)
if resp.NextPage == 0 {
break
}
options.Page = resp.NextPage
}
prTexts := []string{"**List of closed pull-requests since last release**"}

View File

@ -84,6 +84,7 @@ func (g *ghRCMock) UploadReleaseAsset(ctx context.Context, owner string, repo st
type ghICMock struct {
issues []*github.Issue
response github.Response
lastPublished time.Time
owner string
repo string
@ -95,7 +96,7 @@ func (g *ghICMock) ListByRepo(ctx context.Context, owner string, repo string, op
g.repo = repo
g.options = opt
g.lastPublished = opt.Since
return g.issues, nil, nil
return g.issues, &g.response, nil
}
func TestRunGithubPublishRelease(t *testing.T) {