MCPcopy Index your code
hub / github.com/dmno-dev/bumpy / warnChangesetWorkflows

Function warnChangesetWorkflows

packages/bumpy/src/commands/init.ts:232–275  ·  view source on GitHub ↗
(rootDir: string, pm: string)

Source from the content-addressed store, hash-verified

230];
231
232async 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}

Callers 1

initCommandFunction · 0.85

Calls 3

existsFunction · 0.90
listFilesFunction · 0.90
readTextFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…