Skip to content

Commit

Permalink
fix: Added function docs
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Plant <[email protected]>
  • Loading branch information
sampsre committed Nov 29, 2024
1 parent 2218eb7 commit 9e3f3c6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/tfc_trigger/project_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ type ProjectConfig struct {
Workspaces []*TFCWorkspace `yaml:"workspaces"`
}

// Finds the workspace with the deepest matching directory suffix.
// For example, given workspaces with config "terraform/dev/" and a dir of "dev/",
// and a filepath directory of "filesystem/terraform/dev/" - "dev" and "terraform/dev/" are both a suffix
// we would return the ws for "terraform/dev/"as it is the deepest match.
// Special case: if a workspace has config "/" and the input dir is ".", that workspace is returned.
// If no workspace matches, returns nil.
func (cfg *ProjectConfig) workspaceForDir(dir string) *TFCWorkspace {
var longestMatch *TFCWorkspace
var longestMatchDepth int
Expand Down

0 comments on commit 9e3f3c6

Please sign in to comment.