(args: Args)
| 517 | } |
| 518 | |
| 519 | function classifyCommand(args: Args): void { |
| 520 | const targetRepo = argString(args, "target_repo", DEFAULT_TARGET_REPO); |
| 521 | const targetDir = resolve( |
| 522 | argString(args, "target_dir", repositoryProfileFor(targetRepo).checkoutDir), |
| 523 | ); |
| 524 | const artifactDir = resolve(argString(args, "artifact_dir", "skipped-commit-artifacts")); |
| 525 | const commits = commitShasArg(argString(args, "commit_shas", "")); |
| 526 | const review: string[] = []; |
| 527 | const skipped: string[] = []; |
| 528 | for (const sha of commits) { |
| 529 | const metadata = commitMetadata(targetDir, targetRepo, sha); |
| 530 | const changedFiles = changedFilesForCommit(targetDir, sha, metadata.parents); |
| 531 | if (changedFiles.some(isReviewableCommitPath)) { |
| 532 | review.push(sha); |
| 533 | continue; |
| 534 | } |
| 535 | const outputPath = join(artifactDir, artifactReportRelativePath(targetRepo, sha)); |
| 536 | ensureDir(dirname(outputPath)); |
| 537 | writeFileSync( |
| 538 | outputPath, |
| 539 | skippedNonCodeReport({ targetRepo, sha, metadata, changedFiles }), |
| 540 | "utf8", |
| 541 | ); |
| 542 | skipped.push(sha); |
| 543 | } |
| 544 | console.log(JSON.stringify({ review, skipped }, null, 2)); |
| 545 | } |
| 546 | |
| 547 | function publishCheckCommand(args: Args): void { |
| 548 | const targetRepo = argString(args, "target_repo", DEFAULT_TARGET_REPO); |
no test coverage detected