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())
|
fmt.Printf("## Non-ASCII Characters Commit Message Check Failed:\n%s\n", err.Error())
|
||||||
}
|
}
|
||||||
// TODO: find a way to test the release tag
|
// TODO: find a way to test the release tag
|
||||||
bomingzh marked this conversation as resolved
Outdated
|
|||||||
err = healthcheck.CheckReleases(*rootDir, *releaseCategories, *releaseNumber)
|
err = healthcheck.CheckTags(*rootDir, *releaseCategories, *releaseNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("## Release Tag Check Failed:\n%s\n", err.Error())
|
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.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
|
return filepath.SkipDir
|
||||||
} else if localList != "" {
|
case localList != "":
|
||||||
if inString(info.Name(), dirs) {
|
if inString(info.Name(), dirs) {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
}
|
}
|
||||||
} else {
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package healthcheck
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/go-git/go-git/v5"
|
"github.com/go-git/go-git/v5"
|
||||||
"github.com/go-git/go-git/v5/plumbing"
|
"github.com/go-git/go-git/v5/plumbing"
|
||||||
|
@ -31,7 +30,7 @@ func getTagsFromRepo(repoPath string) ([]string, error) {
|
||||||
return tags, nil
|
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)
|
tags, err := getTagsFromRepo(repoPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error getting tags: %v", err)
|
return fmt.Errorf("error getting tags: %v", err)
|
||||||
|
@ -56,7 +55,7 @@ func CheckReleases(repoPath string, category string, n int) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !found {
|
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
|
return nil
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user
check releases need to use Gitea API, just check tags is enough
Yep, only check tags
Where is it tested?