diff --git a/server/events/project_command_builder.go b/server/events/project_command_builder.go index 2e42cfc8a4..00f3d6791e 100644 --- a/server/events/project_command_builder.go +++ b/server/events/project_command_builder.go @@ -636,8 +636,10 @@ func (p *DefaultProjectCommandBuilder) buildProjectPlanCommand(ctx *command.Cont foundDir := false for _, f := range modifiedFiles { - if filepath.Dir(f) == cmd.RepoRelDir { + // Check if the file is in the directory or any subdirectory of the target + if strings.HasPrefix(filepath.Dir(f), cmd.RepoRelDir) { foundDir = true + break } } @@ -661,8 +663,10 @@ func (p *DefaultProjectCommandBuilder) buildProjectPlanCommand(ctx *command.Cont foundDir := false for _, p := range repoCfgProjects { - if filepath.Dir(f) == p.Dir { + // Check if the file is in the directory or any subdirectory of the project directory + if strings.HasPrefix(filepath.Dir(f), p.Dir) { foundDir = true + break } }