allow filtering /repos/{owner}/{repo}/pulls by target base branch queryparam (#33684)

Co-authored-by: Royce Remer <rremer@salesforce.com>
Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
Royce Remer 2025-02-27 09:50:44 -08:00 committed by GitHub
parent 01156f9cc4
commit b7aac5ef9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View file

@ -28,11 +28,16 @@ type PullRequestsOptions struct {
Labels []int64
MilestoneID int64
PosterID int64
BaseBranch string
}
func listPullRequestStatement(ctx context.Context, baseRepoID int64, opts *PullRequestsOptions) *xorm.Session {
sess := db.GetEngine(ctx).Where("pull_request.base_repo_id=?", baseRepoID)
if opts.BaseBranch != "" {
sess.And("pull_request.base_branch=?", opts.BaseBranch)
}
sess.Join("INNER", "issue", "pull_request.issue_id = issue.id")
switch opts.State {
case "closed", "open":