|
1 | 1 | import fs from 'node:fs/promises';
|
2 | 2 | import path from 'node:path';
|
3 | 3 | import { type SimpleGit, simpleGit } from 'simple-git';
|
4 |
| -import type { CoreConfig, Report, ReportsDiff } from '@code-pushup/models'; |
| 4 | +import { |
| 5 | + type CoreConfig, |
| 6 | + DEFAULT_PERSIST_OUTPUT_DIR, |
| 7 | + type Report, |
| 8 | + type ReportsDiff, |
| 9 | +} from '@code-pushup/models'; |
5 | 10 | import { stringifyError } from '@code-pushup/utils';
|
6 | 11 | import {
|
7 | 12 | type CommandContext,
|
@@ -62,12 +67,19 @@ export async function runInCI(
|
62 | 67 | .map(({ files }) => files.diff?.json)
|
63 | 68 | .filter((file): file is string => file != null);
|
64 | 69 | if (diffJsonPaths.length > 0) {
|
65 |
| - const diffPath = await runMergeDiffs( |
| 70 | + const tmpDiffPath = await runMergeDiffs( |
66 | 71 | diffJsonPaths,
|
67 | 72 | createCommandContext(settings, projects[0]),
|
68 | 73 | );
|
69 |
| - logger.debug(`Merged ${diffJsonPaths.length} diffs into ${diffPath}`); |
70 |
| - const commentId = await commentOnPR(diffPath, api, logger); |
| 74 | + logger.debug(`Merged ${diffJsonPaths.length} diffs into ${tmpDiffPath}`); |
| 75 | + const diffPath = path.join( |
| 76 | + settings.directory, |
| 77 | + DEFAULT_PERSIST_OUTPUT_DIR, |
| 78 | + path.basename(tmpDiffPath), |
| 79 | + ); |
| 80 | + await fs.cp(tmpDiffPath, diffPath); |
| 81 | + logger.debug(`Copied ${tmpDiffPath} to ${diffPath}`); |
| 82 | + const commentId = await commentOnPR(tmpDiffPath, api, logger); |
71 | 83 | return {
|
72 | 84 | mode: 'monorepo',
|
73 | 85 | projects: projectResults,
|
|
0 commit comments