mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-03-11 21:59:54 +00:00
feat: go 1.25.5, dependency updates, renamed internal/errors (#129)
* feat: rename internal/errors to internal/apperrors * fix(tests): clear env values before using in tests * feat: rename internal/errors to internal/apperrors * chore(deps): update go and all dependencies * chore: remove renovate from pre-commit, formatting * chore: sonarcloud fixes * feat: consolidate constants to appconstants/constants.go * chore: sonarcloud fixes * feat: simplification, deduplication, test utils * chore: sonarcloud fixes * chore: sonarcloud fixes * chore: sonarcloud fixes * chore: sonarcloud fixes * chore: clean up * fix: config discovery, const deduplication * chore: fixes
This commit is contained in:
@@ -11,6 +11,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/ivuorinen/gh-action-readme/appconstants"
|
||||
)
|
||||
|
||||
// embeddedTemplates contains all template files embedded in the binary
|
||||
@@ -24,8 +26,8 @@ func GetEmbeddedTemplate(templatePath string) ([]byte, error) {
|
||||
cleanPath := strings.TrimPrefix(filepath.ToSlash(templatePath), "/")
|
||||
|
||||
// If path doesn't start with templates/, prepend it
|
||||
if !strings.HasPrefix(cleanPath, "templates/") {
|
||||
cleanPath = "templates/" + cleanPath
|
||||
if !strings.HasPrefix(cleanPath, appconstants.DirTemplates) {
|
||||
cleanPath = appconstants.DirTemplates + cleanPath
|
||||
}
|
||||
|
||||
return embeddedTemplates.ReadFile(cleanPath)
|
||||
@@ -39,8 +41,8 @@ func GetEmbeddedTemplateFS() fs.FS {
|
||||
// IsEmbeddedTemplateAvailable checks if a template exists in the embedded filesystem.
|
||||
func IsEmbeddedTemplateAvailable(templatePath string) bool {
|
||||
cleanPath := strings.TrimPrefix(filepath.ToSlash(templatePath), "/")
|
||||
if !strings.HasPrefix(cleanPath, "templates/") {
|
||||
cleanPath = "templates/" + cleanPath
|
||||
if !strings.HasPrefix(cleanPath, appconstants.DirTemplates) {
|
||||
cleanPath = appconstants.DirTemplates + cleanPath
|
||||
}
|
||||
|
||||
_, err := embeddedTemplates.ReadFile(cleanPath)
|
||||
|
||||
Reference in New Issue
Block a user