Skip to content

Commit 4c833ca

Browse files
authored
Merge pull request #9 from mackee/feature/log-contains-base
can specify base branch names of merged pull requests
2 parents 6a3b948 + 7a1a60e commit 4c833ca

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

config.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ type call struct {
2727
}
2828

2929
type Repo struct {
30-
Owner string `yaml:"owner"`
31-
Repo string `yaml:"repo"`
32-
Head string `yaml:"head"`
33-
Base string `yaml:"base"`
30+
Owner string `yaml:"owner"`
31+
Repo string `yaml:"repo"`
32+
Head string `yaml:"head"`
33+
LogContainsBases []string `yaml:"log_contains_bases"`
34+
Base string `yaml:"base"`
3435
}
3536

3637
func (r Repo) JoinedHead() string {
@@ -40,6 +41,16 @@ func (r Repo) JoinedHead() string {
4041
return strings.Join([]string{r.Owner, r.Head}, ":")
4142
}
4243

44+
func (r Repo) ContainsBase(base string) bool {
45+
bases := append(r.LogContainsBases, r.Head)
46+
for _, _base := range bases {
47+
if _base == base {
48+
return true
49+
}
50+
}
51+
return false
52+
}
53+
4354
func NewConfig(r io.Reader) (Config, error) {
4455
var c Config
4556

fetcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (f *fetcher) MergedPullRequests(ctx context.Context) (PullRequests, error)
190190
if !pr.Fetched {
191191
continue
192192
}
193-
if pr.Base != f.Repo.Head {
193+
if !f.Repo.ContainsBase(pr.Base) {
194194
continue
195195
}
196196
freezedPRs = append(freezedPRs, *pr)

0 commit comments

Comments
 (0)