getAllIncludeFiles returns all include files in .github/workflows subdirectories
()
| 336 | |
| 337 | // getAllIncludeFiles returns all include files in .github/workflows subdirectories |
| 338 | func getAllIncludeFiles() ([]string, error) { |
| 339 | workflowsDir := constants.GetWorkflowDir() |
| 340 | var allIncludes []string |
| 341 | |
| 342 | err := filepath.Walk(workflowsDir, func(path string, info os.FileInfo, err error) error { |
| 343 | if err != nil { |
| 344 | return err |
| 345 | } |
| 346 | |
| 347 | if !info.IsDir() && strings.HasSuffix(info.Name(), ".md") { |
| 348 | relPath, err := filepath.Rel(workflowsDir, path) |
| 349 | if err != nil { |
| 350 | return err |
| 351 | } |
| 352 | |
| 353 | // Only consider files in subdirectories as potential include files |
| 354 | // Root-level .md files are workflow files, not include files |
| 355 | if strings.Contains(relPath, string(filepath.Separator)) { |
| 356 | allIncludes = append(allIncludes, relPath) |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | return nil |
| 361 | }) |
| 362 | |
| 363 | return allIncludes, err |
| 364 | } |
| 365 | |
| 366 | // cleanupAllIncludes removes all include files when no workflows remain |
| 367 | func cleanupAllIncludes(verbose bool) error { |
no test coverage detected