MCPcopy Create free account
hub / github.com/github/awesome-copilot / generateWorkflowsSection

Function generateWorkflowsSection

eng/update-readme.mjs:530–581  ·  view source on GitHub ↗

* Generate the workflows section with a table of all agentic workflows

(workflowsDir)

Source from the content-addressed store, hash-verified

528 * Generate the workflows section with a table of all agentic workflows
529 */
530function generateWorkflowsSection(workflowsDir) {
531 if (!fs.existsSync(workflowsDir)) {
532 console.log(`Workflows directory does not exist: ${workflowsDir}`);
533 return "";
534 }
535
536 // Get all .md workflow files (flat, no subfolders)
537 const workflowFiles = fs.readdirSync(workflowsDir).filter((file) => {
538 return file.endsWith(".md") && file !== ".gitkeep";
539 });
540
541 // Parse each workflow file
542 const workflowEntries = workflowFiles
543 .map((file) => {
544 const filePath = path.join(workflowsDir, file);
545 const metadata = parseWorkflowMetadata(filePath);
546 if (!metadata) return null;
547
548 return {
549 file,
550 name: metadata.name,
551 description: metadata.description,
552 triggers: metadata.triggers,
553 tags: metadata.tags,
554 };
555 })
556 .filter((entry) => entry !== null)
557 .sort((a, b) => a.name.localeCompare(b.name));
558
559 console.log(`Found ${workflowEntries.length} workflow(s)`);
560
561 if (workflowEntries.length === 0) {
562 return "";
563 }
564
565 // Create table header
566 let content =
567 "| Name | Description | Triggers |\n| ---- | ----------- | -------- |\n";
568
569 // Generate table rows for each workflow
570 for (const workflow of workflowEntries) {
571 const link = `../workflows/${workflow.file}`;
572 const triggers =
573 workflow.triggers.length > 0 ? workflow.triggers.join(", ") : "N/A";
574
575 content += `| [${workflow.name}](${link}) | ${formatTableCell(
576 workflow.description
577 )} | ${triggers} |\n`;
578 }
579
580 return `${TEMPLATES.workflowsSection}\n${TEMPLATES.workflowsUsage}\n\n${content}`;
581}
582
583/**
584 * Generate the skills section with a table of all skills

Callers

nothing calls this directly

Calls 2

parseWorkflowMetadataFunction · 0.90
formatTableCellFunction · 0.85

Tested by

no test coverage detected