Skip to content

Commit

Permalink
feat: do not show merged PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Nov 7, 2018
1 parent 982d387 commit 10aa1ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ func (s *Server) GetIPA(c echo.Context) error {
return echo.NewHTTPError(http.StatusInternalServerError, "IPA not found")
}

var masterMerge = regexp.MustCompile(`^Merge pull request #([0-9]+) from (.*)$`)

func (s *Server) ListReleaseIOS(c echo.Context) error {
html := `<table style="width:100%;font-size:150%;text-align:left;"><thead>`
html += `<th>branch</th>`
Expand All @@ -125,6 +127,18 @@ func (s *Server) ListReleaseIOS(c echo.Context) error {
continue
}

branchName := build.Branch
hover := ""
if build.Branch == "master" {
matches := masterMerge.FindAllStringSubmatch(build.Subject, -1)
if len(matches) == 1 && len(matches[0]) == 3 {
oncePerBranch["pull/"+matches[0][1]] = true
branchName = fmt.Sprintf("%s (%s)", build.Branch, matches[0][1])
hover = matches[0][2]
}

}

//out, _ := json.Marshal(build)
//fmt.Println(string(out))

Expand All @@ -146,7 +160,7 @@ func (s *Server) ListReleaseIOS(c echo.Context) error {
}

elems := []string{
fmt.Sprintf(`<a href="%s" style="color:%s">%s</a>`, branchLink, branchColor, build.Branch),
fmt.Sprintf(`<a href="%s" title="%s" style="color:%s">%s</a>`, branchLink, hover, branchColor, branchName),
fmt.Sprintf(`<a href="%s">%d</a>`, build.BuildURL, build.BuildNum),
build.User.Login,
//status,
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (s *Server) refreshCache() error {

if s.cache.mostRecentBuild.IsZero() { // first fill
log.Print("fetch all builds")
for page := 0; page < 10; page++ {
for page := 0; page < 20; page++ {
builds, err := s.client.Builds("", "", 100, page*100)
if err != nil {
return err
Expand Down

0 comments on commit 10aa1ed

Please sign in to comment.