chore: rename check

This commit is contained in:
张泊明518370910136 2024-06-29 15:43:03 -04:00
parent 38ae48e30a
commit 2838f4171f
GPG Key ID: D47306D7062CDA9D
3 changed files with 7 additions and 7 deletions

View File

@ -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())
}

View File

@ -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
}
}

View File

@ -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
}