mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-01-26 03:04:10 +00:00
* 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
21 lines
524 B
Go
21 lines
524 B
Go
package internal
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// findFirstExistingConfig searches for the first existing config file
|
|
// from a list of config names within a base directory.
|
|
// Returns the full path to the first existing config file, or empty string if none exist.
|
|
func findFirstExistingConfig(basePath string, configNames []string) (string, bool) {
|
|
for _, name := range configNames {
|
|
path := filepath.Join(basePath, name)
|
|
if _, err := os.Stat(path); err == nil {
|
|
return path, true
|
|
}
|
|
}
|
|
|
|
return "", false
|
|
}
|