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

Function main

actions/setup/js/parse_mcp_scripts_logs.cjs:17–70  ·  view source on GitHub ↗

* Main function to parse and display mcp-scripts logs

()

Source from the content-addressed store, hash-verified

15 * Main function to parse and display mcp-scripts logs
16 */
17async function main() {
18 try {
19 // Get the mcp-scripts logs directory path
20 const mcpScriptsLogsDir = `/tmp/gh-aw/mcp-scripts/logs/`;
21
22 if (!fs.existsSync(mcpScriptsLogsDir)) {
23 core.info(`No mcp-scripts logs directory found at: ${mcpScriptsLogsDir}`);
24 return;
25 }
26
27 // Find all log files
28 const files = fs.readdirSync(mcpScriptsLogsDir).filter(file => file.endsWith(".log"));
29
30 if (files.length === 0) {
31 core.info(`No mcp-scripts log files found in: ${mcpScriptsLogsDir}`);
32 return;
33 }
34
35 core.info(`Found ${files.length} mcp-scripts log file(s)`);
36
37 // Parse all log files and aggregate results
38 const allLogEntries = [];
39
40 for (const file of files) {
41 const filePath = path.join(mcpScriptsLogsDir, file);
42 core.info(`Parsing mcp-scripts log: ${file}`);
43
44 const content = fs.readFileSync(filePath, "utf8");
45 const lines = content.split("\n").filter(line => line.trim());
46
47 for (const line of lines) {
48 const entry = parseMCPScriptsLogLine(line);
49 if (entry) {
50 allLogEntries.push(entry);
51 }
52 }
53 }
54
55 if (allLogEntries.length === 0) {
56 core.info("No parseable log entries found in mcp-scripts logs");
57 return;
58 }
59
60 // Generate plain text summary for core.info (Copilot CLI style)
61 const plainTextSummary = generatePlainTextSummary(allLogEntries);
62 core.info(plainTextSummary);
63
64 // Generate step summary
65 const summary = generateMCPScriptsSummary(allLogEntries);
66 core.summary.addRaw(summary).write();
67 } catch (error) {
68 core.setFailed(`${ERR_PARSE}: ${getErrorMessage(error)}`);
69 }
70}
71
72/**
73 * Parses a single mcp-scripts log line

Callers 1

Calls 4

parseMCPScriptsLogLineFunction · 0.85
generatePlainTextSummaryFunction · 0.70
getErrorMessageFunction · 0.70

Tested by

no test coverage detected