Read delivery tokens from files and check selected paths before release

This commit is contained in:
2026-11-01 15:39:36 +00:00
parent 6650b639e1
commit 792bfc4eca
17 changed files with 361 additions and 23 deletions

View File

@@ -0,0 +1,24 @@
package validation
import (
"path"
"strings"
)
func checkUntrackedFiles(tree *CandidateTree, names []string) error {
var findings []Finding
for _, name := range names {
clean := path.Clean(name)
if name == "" || path.IsAbs(name) || clean == "." || clean == ".." || strings.HasPrefix(clean, "../") {
findings = append(findings, Finding{Path: name, Message: "expected a repository-relative file path"})
continue
}
if _, exists := tree.Entry(clean); exists {
findings = append(findings, Finding{Path: clean, Message: "file must be absent from the committed candidate"})
}
}
if len(findings) == 0 {
return nil
}
return &Failure{Check: UntrackedFiles, Findings: findings}
}