feat: repo health check (#16) #17
|
@ -73,7 +73,7 @@ func main() {
|
|||
fmt.Printf("## Non-ASCII Characters Commit Message Check Failed:\n%s\n", err.Error())
|
||||
}
|
||||
// TODO: find a way to test the release tag
|
||||
err = healthcheck.CheckReleases(*rootDir, *releaseCategories, *releaseNumber)
|
||||
err = healthcheck.CheckTags(*rootDir, *releaseCategories, *releaseNumber)
|
||||
if err != nil {
|
||||
fmt.Printf("## Release Tag Check Failed:\n%s\n", err.Error())
|
||||
}
|
||||
|
|
|
@ -54,13 +54,14 @@ func getForbiddens(root string, fileList []string, localList string) ([]string,
|
|||
}
|
||||
|
||||
if info.IsDir() {
|
||||
if info.Name() == ".git" || info.Name() == ".gitea" || info.Name() == "ci" {
|
||||
switch {
|
||||
case info.Name() == ".git" || info.Name() == ".gitea" || info.Name() == "ci":
|
||||
return filepath.SkipDir
|
||||
} else if localList != "" {
|
||||
case localList != "":
|
||||
if inString(info.Name(), dirs) {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package healthcheck
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/go-git/go-git/v5"
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
|
@ -31,7 +30,7 @@ func getTagsFromRepo(repoPath string) ([]string, error) {
|
|||
return tags, nil
|
||||
}
|
||||
|
||||
func CheckReleases(repoPath string, category string, n int) error {
|
||||
func CheckTags(repoPath string, category string, n int) error {
|
||||
tags, err := getTagsFromRepo(repoPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting tags: %v", err)
|
||||
|
@ -56,7 +55,7 @@ func CheckReleases(repoPath string, category string, n int) error {
|
|||
}
|
||||
}
|
||||
if !found {
|
||||
return fmt.Errorf("Wrong release tag '%s' or missing release tags. Please use one of '%s'.", target, strings.Join(tags, "', '"))
|
||||
return fmt.Errorf("Expected tag '%s' not found.", target)
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user