9
9
} from './report' ;
10
10
import path from 'path' ;
11
11
12
- // Helper function to determine if this is a merge event
13
12
function isMergeEvent ( ) : boolean {
14
13
const { context } = require ( '@actions/github' ) ;
15
14
return (
@@ -19,7 +18,6 @@ function isMergeEvent(): boolean {
19
18
) ;
20
19
}
21
20
22
- // Helper function to determine if this is a PR event
23
21
function isPullRequestEvent ( ) : boolean {
24
22
const { context } = require ( '@actions/github' ) ;
25
23
return context . eventName === 'pull_request' ;
@@ -71,7 +69,6 @@ function isPullRequestEvent(): boolean {
71
69
await generateSizeReport ( currentSizeData ) ;
72
70
}
73
71
} else if ( isPullRequestEvent ( ) ) {
74
- // MR 提交时:只下载目标分支的工件(如果存在)并生成比较报告
75
72
console . log (
76
73
'📥 Detected pull request event - downloading target branch artifact if exists' ,
77
74
) ;
@@ -90,7 +87,6 @@ function isPullRequestEvent(): boolean {
90
87
await githubService . getTargetBranchLatestCommit ( ) ;
91
88
console . log ( `Target branch commit hash: ${ targetCommitHash } ` ) ;
92
89
93
- // Create artifact name for target branch (same naming pattern)
94
90
const targetArtifactName = `${ pathParts . join ( '-' ) } -${ fileNameWithoutExt } -${ targetCommitHash } ${ fileExt } ` ;
95
91
console . log ( `Looking for target artifact: ${ targetArtifactName } ` ) ;
96
92
@@ -125,7 +121,6 @@ function isPullRequestEvent(): boolean {
125
121
console . log ( '✅ Successfully loaded demo baseline data' ) ;
126
122
}
127
123
128
- // Generate report card
129
124
await generateSizeReport ( currentSizeData , baselineSizeData || undefined ) ;
130
125
} else {
131
126
console . log ( '🔄 Default behavior - uploading and downloading artifacts' ) ;
@@ -140,7 +135,6 @@ function isPullRequestEvent(): boolean {
140
135
`✅ Successfully uploaded artifact with ID: ${ uploadResponse . id } ` ,
141
136
) ;
142
137
143
- // Try to download target branch artifact
144
138
try {
145
139
const targetCommitHash =
146
140
await githubService . getTargetBranchLatestCommit ( ) ;
@@ -173,7 +167,6 @@ function isPullRequestEvent(): boolean {
173
167
console . warn ( `⚠️ Failed to download target branch artifact: ${ error } ` ) ;
174
168
console . log ( '📝 Using demo baseline data for comparison' ) ;
175
169
176
- // Generate report card with demo baseline
177
170
const currentSizeData = loadSizeData ( fullPath ) ;
178
171
if ( currentSizeData ) {
179
172
const demoBaseline = getDemoBaselineData ( ) ;
0 commit comments