(rootDir: string, pm: string)
| 230 | ]; |
| 231 | |
| 232 | async function warnChangesetWorkflows(rootDir: string, pm: string): Promise<void> { |
| 233 | const workflowDir = resolve(rootDir, '.github', 'workflows'); |
| 234 | if (!(await exists(workflowDir))) return; |
| 235 | |
| 236 | const files = await listFiles(workflowDir); |
| 237 | const yamlFiles = files.filter((f) => f.endsWith('.yml') || f.endsWith('.yaml')); |
| 238 | if (yamlFiles.length === 0) return; |
| 239 | |
| 240 | const runner = PM_RUNNER[pm] || 'npx bumpy'; |
| 241 | const hits: Array<{ file: string; matches: Array<{ line: number; found: string; suggestion: string }> }> = []; |
| 242 | |
| 243 | for (const file of yamlFiles) { |
| 244 | const content = await readText(resolve(workflowDir, file)); |
| 245 | const lines = content.split('\n'); |
| 246 | const fileMatches: Array<{ line: number; found: string; suggestion: string }> = []; |
| 247 | |
| 248 | for (let i = 0; i < lines.length; i++) { |
| 249 | const line = lines[i]!; |
| 250 | for (const { pattern, replacement } of CHANGESET_PATTERNS) { |
| 251 | const match = line.match(pattern); |
| 252 | if (match) { |
| 253 | fileMatches.push({ line: i + 1, found: match[0], suggestion: replacement }); |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | if (fileMatches.length > 0) { |
| 259 | hits.push({ file, matches: fileMatches }); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | if (hits.length === 0) return; |
| 264 | |
| 265 | console.log(); |
| 266 | log.warn('Found changeset references in GitHub workflows:'); |
| 267 | for (const { file, matches } of hits) { |
| 268 | log.dim(` .github/workflows/${file}`); |
| 269 | for (const { line, found, suggestion } of matches) { |
| 270 | log.dim(` L${line}: ${pc.red(found)} → ${pc.green(suggestion)}`); |
| 271 | } |
| 272 | } |
| 273 | console.log(); |
| 274 | log.dim(` Run ${pc.cyan(`${runner} ci setup`)} for help configuring CI workflows.`); |
| 275 | } |
no test coverage detected
searching dependent graphs…