diff --git a/core/section/github/commits_template.go b/core/section/github/commits_template.go index 59f1021b..bd27dc43 100644 --- a/core/section/github/commits_template.go +++ b/core/section/github/commits_template.go @@ -17,7 +17,14 @@ const commitsTemplate = ` {{if .HasAuthorStats}}

Contributors

-

There are 3 contributors across 6 repositories.

+

+ There + {{if eq 1 (len .AuthorStats)}}is{{else}}are{{end}} + {{len .AuthorStats}} + {{if eq 1 (len .AuthorStats)}}contributor{{else}}contributors{{end}} + across {{.RepoCount}} + {{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}} +

diff --git a/core/section/github/issues_template.go b/core/section/github/issues_template.go index c04214a3..8a241a62 100644 --- a/core/section/github/issues_template.go +++ b/core/section/github/issues_template.go @@ -30,7 +30,10 @@ const (
{{if .HasIssues}}

Issues

-

There are {{.ClosedIssues}} closed and {{.OpenIssues}} open across 6 repositories.

+

+ There are {{.ClosedIssues}} closed and {{.OpenIssues}} open across {{.RepoCount}} + {{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}} +

{{if .ShowList}} Including issues labelled diff --git a/core/section/github/milestones.go b/core/section/github/milestones.go index b382f222..63959d61 100644 --- a/core/section/github/milestones.go +++ b/core/section/github/milestones.go @@ -174,30 +174,34 @@ func refreshMilestones(gr *githubRender, config *githubConfig, client *gogithub. func renderMilestones(payload *githubRender, c *githubConfig) error { hadRepo := make(map[string]bool) + payload.RepoCount = 0 for _, orb := range payload.List { rName := orb.Owner + "/" + orb.Repo if !hadRepo[rName] { + if orb.Included { - issuesOpen, issuesClosed := 0, 0 - for _, iss := range payload.Issues { - if iss.Repo == repoName(rName) { - if iss.Milestone == noMilestone { - if iss.IsOpen { - issuesOpen++ - } else { - issuesClosed++ + payload.RepoCount++ + issuesOpen, issuesClosed := 0, 0 + for _, iss := range payload.Issues { + if iss.Repo == repoName(rName) { + if iss.Milestone == noMilestone { + if iss.IsOpen { + issuesOpen++ + } else { + issuesClosed++ + } } } } - } - if issuesClosed+issuesOpen > 0 { - payload.Milestones = append(payload.Milestones, githubMilestone{ - Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true, - OpenIssues: issuesOpen, ClosedIssues: issuesClosed, URL: orb.URL, - }) - } + if issuesClosed+issuesOpen > 0 { + payload.Milestones = append(payload.Milestones, githubMilestone{ + Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true, + OpenIssues: issuesOpen, ClosedIssues: issuesClosed, URL: orb.URL, + }) + } - hadRepo[rName] = true + hadRepo[rName] = true + } } } diff --git a/core/section/github/milestones_template.go b/core/section/github/milestones_template.go index ce940412..4b49a9e4 100644 --- a/core/section/github/milestones_template.go +++ b/core/section/github/milestones_template.go @@ -32,17 +32,27 @@ const ( {{if .HasMilestones}}

Milestones

-

There is {{.ClosedMS}} milestone closed and {{.OpenMS}} milestone open across #number repositories.

+

+ There are + {{.ClosedMS}} + {{if eq 1 .ClosedMS}} milestone {{else}} milestones {{end}} + closed and {{.OpenMS}} + {{if eq 1 .OpenMS}} milestone {{else}} milestones {{end}} + open across {{.RepoCount}} + {{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}} +

{{range $data := .Milestones}}
- {{if $data.IsOpen}} - ` + openMSsvg + ` - {{else}} - ` + closedMSsvg + ` + {{if $data.IsMilestone}} + {{if $data.IsOpen}} + ` + openMSsvg + ` + {{else}} + ` + closedMSsvg + ` + {{end}} {{end}} diff --git a/core/section/github/model.go b/core/section/github/model.go index b9a680fd..7e45be4d 100644 --- a/core/section/github/model.go +++ b/core/section/github/model.go @@ -24,6 +24,7 @@ import ( type githubRender struct { Config githubConfig `json:"config"` List []githubBranch `json:"list"` + RepoCount int `json:"repoCount"` ShowList bool `json:"showList"` ShowIssueNumbers bool `json:"showIssueNumbers"` BranchCommits []githubCommit `json:"branchCommits"` diff --git a/core/section/github/summary_template.go b/core/section/github/summary_template.go index ed53e118..545e3786 100644 --- a/core/section/github/summary_template.go +++ b/core/section/github/summary_template.go @@ -27,7 +27,12 @@ const summaryTemplate = ` {{if .HasSharedLabels}}

Common Labels

-

There is 1 shared label across the repositories.

+

There + {{if eq 1 (len .SharedLabels)}} is {{else}} are {{end}} + {{len .SharedLabels}} + shared + {{if eq 1 (len .SharedLabels)}} label {{else}} labels {{end}} + across the repositories.

{{range $slabel := .SharedLabels}}