Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
Add source branch filter (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
samcontesse committed Feb 13, 2022
1 parent 8a865c6 commit 71481b6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ resources:
* `pipeline_name`(string): When set, this url will be used to override `BUILD_PIPELINE_NAME` during commit status updates.
* `labels`(string[]): Filter merge requests by label`[]`
* `target_branch`(string): Filter merge requests by target_branch. Default is empty string.
* `source_branch`(string): Filter merge requests by source_branch. Default is empty string.
* `sort` (string): Merge requests sorting order, either `asc` (default) or `desc` to reverse.

## Behavior
Expand Down
2 changes: 2 additions & 0 deletions pkg/check/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ func (command *Command) Run(request Request) (Response, error) {
Sort: gitlab.String(sort),
Labels: &labels,
TargetBranch: gitlab.String(request.Source.TargetBranch),
SourceBranch: gitlab.String(request.Source.SourceBranch),
}

requests, _, err := command.client.MergeRequests.ListProjectMergeRequests(request.Source.GetProjectPath(), options)
if err != nil {
return Response{}, err
Expand Down
1 change: 1 addition & 0 deletions pkg/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Source struct {
PipelineName string `json:"pipeline_name,omitempty"`
Labels []string `json:"labels,omitempty"`
TargetBranch string `json:"target_branch,omitempty"`
SourceBranch string `json:"source_branch,omitempty"`
Sort string `json:"sort,omitempty"`
Paths []string `json:"paths,omitempty"`
IgnorePaths []string `json:"ignore_paths,omitempty"`
Expand Down

0 comments on commit 71481b6

Please sign in to comment.