Compare commits

..

No commits in common. "90d5a23fcc0df77b4b4a97360bd128c3dc106185" and "5f8e4f00ea238deb7d013de687929d6c2bb91052" have entirely different histories.

View File

@ -6,8 +6,6 @@ import (
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"os" "os"
"os/exec" "os/exec"
"path"
"path/filepath"
"slices" "slices"
"strings" "strings"
"syscall" "syscall"
@ -98,30 +96,26 @@ func (hook *BPMHook) Execute(packageChanges map[string]string, verbose bool, roo
// Get modified files slice // Get modified files slice
modifiedFiles := make([]*PackageFileEntry, 0) modifiedFiles := make([]*PackageFileEntry, 0)
for pkg := range packageChanges { for pkg, _ := range packageChanges {
modifiedFiles = append(modifiedFiles, GetPackageFiles(pkg, rootDir)...) modifiedFiles = append(modifiedFiles, GetPackageFiles(pkg, rootDir)...)
} }
// Check if any targets are met // Check if any targets are met
targetMet := false targetMet := false
for _, target := range hook.Targets { for _, t1 := range hook.Targets {
if targetMet { if targetMet {
break break
} }
if hook.TargetType == "package" { if hook.TargetType == "package" {
for change, operation := range packageChanges { for t2, operation := range packageChanges {
if target == change && slices.Contains(hook.TriggerOperations, operation) { if t1 == t2 && slices.Contains(hook.TriggerOperations, operation) {
targetMet = true targetMet = true
break break
} }
} }
} else { } else {
glob, err := filepath.Glob(path.Join(rootDir, target)) for _, t2 := range modifiedFiles {
if err != nil { if strings.HasPrefix(t2.Path, t1) {
return err
}
for _, change := range modifiedFiles {
if slices.Contains(glob, path.Join(rootDir, change.Path)) {
targetMet = true targetMet = true
break break
} }