File tree 2 files changed +10
-0
lines changed
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -28,11 +28,16 @@ type PullRequestsOptions struct {
28
28
Labels []int64
29
29
MilestoneID int64
30
30
PosterID int64
31
+ BaseBranch string
31
32
}
32
33
33
34
func listPullRequestStatement (ctx context.Context , baseRepoID int64 , opts * PullRequestsOptions ) * xorm.Session {
34
35
sess := db .GetEngine (ctx ).Where ("pull_request.base_repo_id=?" , baseRepoID )
35
36
37
+ if len (opts .BaseBranch ) > 0 {
38
+ sess .And ("pull_request.base_branch=?" , opts .BaseBranch )
39
+ }
40
+
36
41
sess .Join ("INNER" , "issue" , "pull_request.issue_id = issue.id" )
37
42
switch opts .State {
38
43
case "closed" , "open" :
Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ func ListPullRequests(ctx *context.APIContext) {
59
59
// description: Name of the repo
60
60
// type: string
61
61
// required: true
62
+ // - name: base_branch
63
+ // in: query
64
+ // description: Filter by target base branch of the pull request
65
+ // type: string
62
66
// - name: state
63
67
// in: query
64
68
// description: State of pull request
@@ -132,6 +136,7 @@ func ListPullRequests(ctx *context.APIContext) {
132
136
Labels : labelIDs ,
133
137
MilestoneID : ctx .FormInt64 ("milestone" ),
134
138
PosterID : posterID ,
139
+ BaseBranch : ctx .FormTrim ("base_branch" ),
135
140
})
136
141
if err != nil {
137
142
ctx .APIErrorInternal (err )
You can’t perform that action at this time.
0 commit comments