@@ -6,33 +6,14 @@ import {
66import * as core from '@actions/core'
77import * as github from '@actions/github'
88import type { GitBranch } from '@code-pushup/ci'
9- import { DEFAULT_PERSIST_FILENAME } from '@code-pushup/models'
10- import { projectToFilename } from '@code-pushup/utils'
119import type { RequestError } from '@octokit/request-error'
1210import { readdir , rm } from 'node:fs/promises'
13- import { join } from 'node:path'
11+ import path from 'node:path'
1412import type { ActionInputs } from './inputs'
1513
16- const REPORT_ARTIFACT_NAME = 'code-pushup-report'
17- const DIFF_ARTIFACT_NAME = 'code-pushup-report-diff'
14+ export const REPORT_ARTIFACT_NAME = 'code-pushup-report'
1815const ARTIFACT_DIR = 'tmp'
1916
20- export function createReportArtifactName ( project ?: string ) : string {
21- return createArtifactName ( REPORT_ARTIFACT_NAME , project )
22- }
23-
24- export function createDiffArtifactName ( project ?: string ) : string {
25- return createArtifactName ( DIFF_ARTIFACT_NAME , project )
26- }
27-
28- function createArtifactName ( base : string , project : string | undefined ) : string {
29- if ( ! project ) {
30- return base
31- }
32- const suffix = projectToFilename ( project )
33- return `${ base } -${ suffix } `
34- }
35-
3617export async function uploadArtifact (
3718 artifact : ArtifactClient ,
3819 name : string ,
@@ -96,7 +77,7 @@ export async function downloadReportArtifact(
9677 }
9778
9879 const { artifact : reportArtifact } = await artifact . getArtifact (
99- createReportArtifactName ( project ) ,
80+ REPORT_ARTIFACT_NAME ,
10081 { findBy }
10182 )
10283 core . debug (
@@ -111,18 +92,25 @@ export async function downloadReportArtifact(
11192 if ( ! downloadPath ) {
11293 throw new Error ( 'Unexpected empty downloadPath' )
11394 }
114- const files = await readdir ( downloadPath )
95+ const files = await readdir ( downloadPath , { recursive : true } )
11596 core . debug (
11697 `Downloaded artifact to ${ downloadPath } , contains files: ${ files . join ( ', ' ) } `
11798 )
11899
119- const reportJsonFile = `${ DEFAULT_PERSIST_FILENAME } .json`
120- if ( ! files . includes ( reportJsonFile ) ) {
121- core . warning ( `Downloaded artifact doesn't contain ${ reportJsonFile } ` )
100+ const expectedFile = path . join (
101+ '.code-pushup' ,
102+ '.ci' ,
103+ project ?? '' ,
104+ '.current' ,
105+ 'report.json'
106+ )
107+
108+ if ( ! files . includes ( expectedFile ) ) {
109+ core . warning ( `Downloaded artifact doesn't contain ${ expectedFile } ` )
122110 return null
123111 }
124112
125- return join ( downloadPath , reportJsonFile )
113+ return path . join ( downloadPath , expectedFile )
126114 } catch ( err ) {
127115 if ( err instanceof ArtifactNotFoundError ) {
128116 core . info (
0 commit comments