Skip to content

Commit

Permalink
Fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed Feb 26, 2024
1 parent 1ea2250 commit 9678007
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions pkg/webhooks/github/actions/aggregate_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ func (r *AggregateReleases) AggregateRelease(ctx context.Context, p *AggregateRe
return nil
}

openPR, err := findOpenReleasePR(ctx, r.client, r.client.Organization(), r.repoName, r.branch, r.branchBase)
openPR, err := findOpenReleasePR(ctx, r.client.GetV3Client(), r.client.Organization(), r.repoName, r.branch, r.branchBase)
if err != nil {
return err
}

if openPR != nil {
frozen, err := isReleaseFreeze(ctx, r.client, openPR)
frozen, err := isReleaseFreeze(ctx, r.client.GetV3Client(), openPR)
if err != nil {
return err
}
Expand Down Expand Up @@ -220,8 +220,8 @@ func (r *AggregateReleases) AggregateRelease(ctx context.Context, p *AggregateRe
return nil
}

func findOpenReleasePR(ctx context.Context, client *clients.Github, owner, repo, branch, base string) (*v3.PullRequest, error) {
prs, _, err := client.GetV3AppClient().PullRequests.List(ctx, owner, repo, &v3.PullRequestListOptions{
func findOpenReleasePR(ctx context.Context, client *v3.Client, owner, repo, branch, base string) (*v3.PullRequest, error) {
prs, _, err := client.PullRequests.List(ctx, owner, repo, &v3.PullRequestListOptions{
State: "open",
Head: branch,
Base: base,
Expand All @@ -237,8 +237,8 @@ func findOpenReleasePR(ctx context.Context, client *clients.Github, owner, repo,
return nil, nil
}

func isReleaseFreeze(ctx context.Context, client *clients.Github, pr *v3.PullRequest) (bool, error) {
comments, _, err := client.GetV3AppClient().PullRequests.ListComments(ctx, *pr.Base.Repo.Owner.Name, *pr.Base.Repo.Name, pointer.SafeDeref(pr.Number), &v3.PullRequestListCommentsOptions{
func isReleaseFreeze(ctx context.Context, client *v3.Client, pr *v3.PullRequest) (bool, error) {
comments, _, err := client.PullRequests.ListComments(ctx, *pr.Base.Repo.Owner.Name, *pr.Base.Repo.Name, pointer.SafeDeref(pr.Number), &v3.PullRequestListCommentsOptions{
Direction: "desc",
})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/webhooks/github/actions/release_drafter.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ func (r *releaseDrafter) draft(ctx context.Context, p *releaseDrafterParams) err
return nil //nolint:nilerr
}

openPR, err := findOpenReleasePR(ctx, r.client, r.client.Organization(), r.repoName, r.branch, r.branchBase)
openPR, err := findOpenReleasePR(ctx, r.client.GetV3Client(), r.client.Organization(), r.repoName, r.branch, r.branchBase)
if err != nil {
return err
}

if openPR != nil {
frozen, err := isReleaseFreeze(ctx, r.client, openPR)
frozen, err := isReleaseFreeze(ctx, r.client.GetV3Client(), openPR)
if err != nil {
return err
}
Expand Down

0 comments on commit 9678007

Please sign in to comment.