countWorkflowMDFiles returns the number of .md files (excluding .lock.yml) in workflowsDir.
(workflowsDir string)
| 139 | // countWorkflowMDFiles returns the number of .md files (excluding .lock.yml) |
| 140 | // in workflowsDir. |
| 141 | func countWorkflowMDFiles(workflowsDir string) (int, error) { |
| 142 | entries, err := os.ReadDir(workflowsDir) |
| 143 | if err != nil { |
| 144 | return 0, err |
| 145 | } |
| 146 | count := 0 |
| 147 | for _, e := range entries { |
| 148 | name := e.Name() |
| 149 | if !e.IsDir() && strings.HasSuffix(name, ".md") && !strings.EqualFold(name, "README.md") { |
| 150 | count++ |
| 151 | } |
| 152 | } |
| 153 | return count, nil |
| 154 | } |
| 155 | |
| 156 | // extractCompilerVersionFromWorkflowsDir reads the first .lock.yml file in |
| 157 | // workflowsDir and extracts the compiler_version from its gh-aw-metadata |