Skip to content

Commit

Permalink
fix: bitbucket pr list options argument (#1153)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Dagelic <[email protected]>
  • Loading branch information
idagelic authored Sep 26, 2024
1 parent f7ccc8d commit cfe1803
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions pkg/gitprovider/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,20 @@ func (g *BitbucketGitProvider) GetRepoPRs(repositoryId string, namespaceId strin
client := g.getApiClient()
var response []*GitPullRequest

fullName := fmt.Sprintf("%s/%s", namespaceId, repositoryId)
opts := &bitbucket.PullRequestsOptions{
RepoSlug: repositoryId,
Owner: namespaceId,
}

owner, repo, err := g.getOwnerAndRepoFromFullName(fullName)
if err != nil {
return nil, err
owner, repo, err := g.getOwnerAndRepoFromFullName(repositoryId)
if err == nil {
opts = &bitbucket.PullRequestsOptions{
RepoSlug: repo,
Owner: owner,
}
}

prList, err := client.Repositories.PullRequests.Get(&bitbucket.PullRequestsOptions{
Owner: owner,
RepoSlug: repo,
})
prList, err := client.Repositories.PullRequests.Get(opts)
if err != nil {
return nil, g.FormatError(err)
}
Expand Down Expand Up @@ -192,8 +195,8 @@ func (g *BitbucketGitProvider) GetRepoPRs(repositoryId string, namespaceId strin
Sha: pr.Source.Commit.Hash,
SourceRepoId: pr.Source.Repository.Full_name,
SourceRepoUrl: repoUrl,
SourceRepoOwner: owner,
SourceRepoName: repo,
SourceRepoOwner: opts.Owner,
SourceRepoName: opts.RepoSlug,
})
}

Expand Down

0 comments on commit cfe1803

Please sign in to comment.