exclude 'build: success' badge from repos with 'article' topic
This commit is contained in:
parent
4f6814f3da
commit
78c7f82ef8
21
pages.go
21
pages.go
@ -174,8 +174,27 @@ func (this *Application) Repopage(w http.ResponseWriter, r *http.Request, repoNa
|
|||||||
|
|
||||||
lines := strings.Split(string(readme), "\n")
|
lines := strings.Split(string(readme), "\n")
|
||||||
|
|
||||||
|
// Check if this repo has the 'article' tag
|
||||||
|
hasArticleTag := false
|
||||||
|
this.reposMut.RLock()
|
||||||
|
for _, rr := range this.reposCache {
|
||||||
|
if rr.Name != repoName {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, topic := range rr.topics {
|
||||||
|
if topic == "article" {
|
||||||
|
hasArticleTag = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.reposMut.RUnlock()
|
||||||
|
|
||||||
// We add some extra badges based on special text entries
|
// We add some extra badges based on special text entries
|
||||||
extraBadgesMd := ` ![](https://img.shields.io/badge/build-success-brightgreen)`
|
extraBadgesMd := ``
|
||||||
|
if !hasArticleTag {
|
||||||
|
extraBadgesMd += ` ![](https://img.shields.io/badge/build-success-brightgreen)`
|
||||||
|
}
|
||||||
extraBadgesMd += ` [![](https://img.shields.io/badge/vcs-git-green?logo=git)](` + repoURL + `)`
|
extraBadgesMd += ` [![](https://img.shields.io/badge/vcs-git-green?logo=git)](` + repoURL + `)`
|
||||||
|
|
||||||
// Inject more badges to 3rd line; or, create badges on 3rd line if there are none already
|
// Inject more badges to 3rd line; or, create badges on 3rd line if there are none already
|
||||||
|
Loading…
Reference in New Issue
Block a user