MCPcopy Create free account
hub / github.com/github/gh-aw / getAllIncludeFiles

Function getAllIncludeFiles

pkg/cli/remove_command.go:338–364  ·  view source on GitHub ↗

getAllIncludeFiles returns all include files in .github/workflows subdirectories

()

Source from the content-addressed store, hash-verified

336
337// getAllIncludeFiles returns all include files in .github/workflows subdirectories
338func 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
367func cleanupAllIncludes(verbose bool) error {

Callers 1

previewOrphanedIncludesFunction · 0.85

Calls 1

GetWorkflowDirFunction · 0.92

Tested by

no test coverage detected