Skip to content

Commit e130529

Browse files
committed
feat(ci): copy merged-report-diff.md from project to root
1 parent f35f90c commit e130529

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

packages/ci/src/lib/run.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import fs from 'node:fs/promises';
22
import path from 'node:path';
33
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';
510
import { stringifyError } from '@code-pushup/utils';
611
import {
712
type CommandContext,
@@ -62,12 +67,19 @@ export async function runInCI(
6267
.map(({ files }) => files.diff?.json)
6368
.filter((file): file is string => file != null);
6469
if (diffJsonPaths.length > 0) {
65-
const diffPath = await runMergeDiffs(
70+
const tmpDiffPath = await runMergeDiffs(
6671
diffJsonPaths,
6772
createCommandContext(settings, projects[0]),
6873
);
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);
7183
return {
7284
mode: 'monorepo',
7385
projects: projectResults,

0 commit comments

Comments
 (0)