(ctx context.Context)
| 159 | } |
| 160 | |
| 161 | func (node *GitNode) ReadContext(ctx context.Context) ([]byte, error) { |
| 162 | // Get or clone the repository into cache |
| 163 | repoDir, err := node.getOrCloneRepo(ctx) |
| 164 | if err != nil { |
| 165 | return nil, err |
| 166 | } |
| 167 | |
| 168 | // Build path to Taskfile in the cached repo |
| 169 | // If node.path is empty, search in repo root; otherwise search in the specified path |
| 170 | // fsext.SearchPath handles both files and directories (searching for DefaultTaskfiles) |
| 171 | searchPath := repoDir |
| 172 | if node.path != "" { |
| 173 | searchPath = filepath.Join(repoDir, node.path) |
| 174 | } |
| 175 | filePath, err := fsext.SearchPath(searchPath, DefaultTaskfiles) |
| 176 | if err != nil { |
| 177 | return nil, err |
| 178 | } |
| 179 | |
| 180 | // Read file from cached repo |
| 181 | b, err := os.ReadFile(filePath) |
| 182 | if err != nil { |
| 183 | return nil, err |
| 184 | } |
| 185 | |
| 186 | return b, nil |
| 187 | } |
| 188 | |
| 189 | func (node *GitNode) ResolveEntrypoint(entrypoint string) (string, error) { |
| 190 | // If the file is remote, we don't need to resolve the path |
no test coverage detected