github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/build/boil_runs.go (about)

     1  package build
     2  
     3  import (
     4  	"github.com/tilt-dev/tilt/pkg/model"
     5  )
     6  
     7  func BoilRuns(runs []model.Run, pathMappings []PathMapping) ([]model.Cmd, error) {
     8  	res := []model.Cmd{}
     9  	localPaths := PathMappingsToLocalPaths(pathMappings)
    10  	for _, run := range runs {
    11  		if run.Triggers.Empty() {
    12  			res = append(res, run.Cmd)
    13  			continue
    14  		}
    15  
    16  		anyMatch, _, err := run.Triggers.AnyMatch(localPaths)
    17  		if err != nil {
    18  			return nil, err
    19  		}
    20  
    21  		if anyMatch {
    22  			res = append(res, run.Cmd)
    23  		}
    24  	}
    25  	return res, nil
    26  }