(username, { includeAllFiles = false } = {})
| 435 | * @returns {object|null} |
| 436 | */ |
| 437 | export const generateContributorReport = (username, { includeAllFiles = false } = {}) => { |
| 438 | console.log(`Inspecting ${username}...`); |
| 439 | |
| 440 | const prs = fetchContributorMergedPrs(username, { includeAllFiles }); |
| 441 | const prReports = prs |
| 442 | .map(pr => generatePRReport({ login: username }, pr, { includeAllFiles })) |
| 443 | .filter(report => report !== null); |
| 444 | |
| 445 | // If no relevant PR reports and not explicitly including all files, skip the contributor entirely |
| 446 | if (prReports.length === 0 && !includeAllFiles) { |
| 447 | return null; |
| 448 | } |
| 449 | |
| 450 | return { |
| 451 | username, |
| 452 | totalPRs: prs.length, |
| 453 | prs: prReports |
| 454 | }; |
| 455 | }; |
| 456 | |
| 457 | /** |
| 458 | * Render a set of contributor reports as markdown for human review. |
no test coverage detected