diff --git a/.github/release.yml b/.github/release.yml index b0c5175c..8da455fe 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -2,3 +2,16 @@ changelog: exclude: labels: - tagpr + categories: + - title: Breaking Changes 🛠 + labels: + - breaking-change + - title: New Features 🎉 + labels: + - enhancement + - title: Fix bug 🐛 + labels: + - bug + - title: Other Changes + labels: + - "*" diff --git a/central/central.go b/central/central.go index 91e23bc8..7ca5a4f1 100644 --- a/central/central.go +++ b/central/central.go @@ -213,10 +213,17 @@ func (c *Central) renderIndex(wr io.Writer) error { if err != nil { return err } - rawRootURL, err := g.GetRawRootURL(ctx, repo.Owner, repo.Repo) + isPrivate, err := g.IsPrivate(ctx, repo.Owner, repo.Repo) if err != nil { return err } + var rawRootURL string + if !isPrivate { + rawRootURL, err = g.GetRawRootURL(ctx, repo.Owner, repo.Repo) + if err != nil { + return err + } + } // Get project root dir proot := c.config.Wd @@ -250,6 +257,7 @@ func (c *Central) renderIndex(wr io.Writer) error { "BadgesLinkRel": badgesLinkRel, "BadgesURLRel": badgesURLRel, "RawRootURL": rawRootURL, + "IsPrivate": isPrivate, } if err := tmpl.Execute(wr, d); err != nil { return err diff --git a/central/index.md.tmpl b/central/index.md.tmpl index 60c56ee0..e64d1ef5 100644 --- a/central/index.md.tmpl +++ b/central/index.md.tmpl @@ -3,7 +3,7 @@ | Repository | Coverage | Code to Test Ratio | Time Execution Time | Badges | | --- | --- | --- | --- | --- | {{- range $r := .Reports }} -| [{{ $r.Repository }}]({{ $.Host }}/{{ $r.Repository }}) | {{ $r | coverage }} | {{ $r | ratio }} | {{ $r | time }} | ![{{ $r.Repository }}]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/coverage.svg){{ if $r.CodeToTestRatio }} ![{{ $r.Repository }}]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/ratio.svg){{ end }}{{ if $r.TestExecutionTime }} ![{{ $r.Repository }}]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/time.svg){{ end }}
Copy status badge markdown```![Coverage]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/coverage.svg)```{{ if $r.CodeToTestRatio }}
```![Code to Test Ratio]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/ratio.svg)```{{ end }}{{ if $r.TestExecutionTime }}
```![Test Execution Time]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/time.svg)```{{ end }}
| +| [{{ $r.Repository }}]({{ $.Host }}/{{ $r.Repository }}) | {{ $r | coverage }} | {{ $r | ratio }} | {{ $r | time }} | ![{{ $r.Repository }}]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/coverage.svg){{ if $r.CodeToTestRatio }} ![{{ $r.Repository }}]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/ratio.svg){{ end }}{{ if $r.TestExecutionTime }} ![{{ $r.Repository }}]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/time.svg){{ end }} {{ if ne $.IsPrivate true }}
Copy status badge markdown```![Coverage]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/coverage.svg)```{{ if $r.CodeToTestRatio }}
```![Code to Test Ratio]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/ratio.svg)```{{ end }}{{ if $r.TestExecutionTime }}
```![Test Execution Time]({{ $.RawRootURL }}/{{ $.BadgesURLRel }}/{{ $r.Repository}}/time.svg)```{{ end }}
{{ end }} | {{- end }} --- diff --git a/gh/gh.go b/gh/gh.go index c8b94e3d..e1984d43 100644 --- a/gh/gh.go +++ b/gh/gh.go @@ -601,6 +601,14 @@ func (g *Gh) GetLatestArtifact(ctx context.Context, owner, repo, name, fp string return nil, errors.New("artifact not found") } +func (g *Gh) IsPrivate(ctx context.Context, owner, repo string) (bool, error) { + r, _, err := g.client.Repositories.Get(ctx, owner, repo) + if err != nil { + return false, err + } + return r.GetPrivate(), nil +} + type minimizeCommentMutation struct { MinimizeComment struct { MinimizedComment struct {