-
Notifications
You must be signed in to change notification settings - Fork 280
feat: Add pull request support to SCM generator #469
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,6 +314,8 @@ type SCMProviderGeneratorGithub struct { | |
TokenRef *SecretRef `json:"tokenRef,omitempty"` | ||
// Scan all branches instead of just the default branch. | ||
AllBranches bool `json:"allBranches,omitempty"` | ||
// Scan all pull requests | ||
AllPullRequests bool `json:"allPullRequests,omitempty"` | ||
} | ||
|
||
// SCMProviderGeneratorGitlab defines a connection info specific to Gitlab. | ||
|
@@ -328,6 +330,8 @@ type SCMProviderGeneratorGitlab struct { | |
TokenRef *SecretRef `json:"tokenRef,omitempty"` | ||
// Scan all branches instead of just the default branch. | ||
AllBranches bool `json:"allBranches,omitempty"` | ||
// Scan all pull requests | ||
AllPullRequests bool `json:"allPullRequests,omitempty"` | ||
} | ||
|
||
// SCMProviderGeneratorFilter is a single repository filter. | ||
|
@@ -342,6 +346,10 @@ type SCMProviderGeneratorFilter struct { | |
LabelMatch *string `json:"labelMatch,omitempty"` | ||
// A regex which must match the branch name. | ||
BranchMatch *string `json:"branchMatch,omitempty"` | ||
// A regex which must match the branch name. | ||
PullRequestBranchMatch *string `json:"pullRequestTitleMatch,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be two filters, one to match source branches, and the other to match target branches? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's an interesting point! I can't recall ever seeing a source branch being merged into a non-default target branch (main, master etc.). In addition, usually, all source branches get merged into one single target branch (otherwise you got a very messy repo 😄 ) which makes filtering the target branch pointless. So IMHO this feature would only support a "corner case". What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider this use case: I want to spin up test environments for each PR against I think this is common enough to justify giving the AppSet the designer to avoid creating an App for that second PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But if it ends up being a lot of work, we could certainly leave it for a future enhancement. |
||
// A regex which must match at least one pull request label. | ||
PullRequestLabelMatch *string `json:"pullRequestLabelMatch,omitempty"` | ||
} | ||
|
||
// PullRequestGenerator defines a generator that scrapes a PullRequest API to find candidate pull requests. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be documentation on what to expect the generator to return if both
allBranches
andallPullRequests
are true.