(events)
| 174 | } |
| 175 | |
| 176 | function formatRecentEvents(events) { |
| 177 | if (!Array.isArray(events) || events.length === 0) return '_No recent events available._'; |
| 178 | const failed = events.filter(function (e) { return e && e.outcome && e.outcome.status === 'failed'; }); |
| 179 | const rows = failed.slice(-MAX_EVENTS).map(function (e, idx) { |
| 180 | const intent = e.intent || '-'; |
| 181 | const gene = (Array.isArray(e.genes_used) && e.genes_used[0]) || '-'; |
| 182 | const outcome = (e.outcome && e.outcome.status) || '-'; |
| 183 | let reason = (e.outcome && e.outcome.reason) || ''; |
| 184 | if (reason.length > 80) reason = reason.slice(0, 80) + '...'; |
| 185 | reason = redactString(reason); |
| 186 | return '| ' + (idx + 1) + ' | ' + intent + ' | ' + gene + ' | ' + outcome + ' | ' + reason + ' |'; |
| 187 | }); |
| 188 | if (rows.length === 0) return '_No failed events in recent history._'; |
| 189 | return '| # | Intent | Gene | Outcome | Reason |\n|---|--------|------|---------|--------|\n' + rows.join('\n'); |
| 190 | } |
| 191 | |
| 192 | function buildIssueBody(opts) { |
| 193 | const fp = opts.envFingerprint || captureEnvFingerprint(); |
no test coverage detected