@@ -47,7 +47,7 @@ export class PullRequestGenerator {
47
47
author : 'github-actions[bot]' ,
48
48
reviewers : [ ] ,
49
49
assignees : [ ] ,
50
- labels : [ 'dependencies' , 'automated' ] ,
50
+ labels : this . generateLabels ( group ) ,
51
51
draft : false ,
52
52
}
53
53
@@ -57,6 +57,30 @@ export class PullRequestGenerator {
57
57
return prs
58
58
}
59
59
60
+ /**
61
+ * Generate labels for a pull request
62
+ */
63
+ generateLabels ( group : UpdateGroup ) : string [ ] {
64
+ const labels = [ 'dependencies' , 'automated' ]
65
+
66
+ // Add update type labels
67
+ if ( group . updateType === 'major' ) {
68
+ labels . push ( 'major' )
69
+ } else if ( group . updateType === 'minor' ) {
70
+ labels . push ( 'minor' )
71
+ } else if ( group . updateType === 'patch' ) {
72
+ labels . push ( 'patch' )
73
+ }
74
+
75
+ // For single package updates, add the specific package name as a label
76
+ if ( group . updates . length === 1 ) {
77
+ const update = group . updates [ 0 ]
78
+ labels . push ( group . title ) // This will be like "chore(deps): update dependency stripe to 18.4.0"
79
+ }
80
+
81
+ return labels
82
+ }
83
+
60
84
/**
61
85
* Generate PR title for an update group
62
86
*/
@@ -133,19 +157,22 @@ export class PullRequestGenerator {
133
157
134
158
let body = `This PR contains the following updates:\n\n`
135
159
136
- // Add summary table (always show for clarity)
137
- body += `## Package Updates Summary\n\n`
138
- body += `| Type | Count |\n`
139
- body += `|------|-------|\n`
140
- if ( packageJsonCount > 0 )
141
- body += `| 📦 NPM Packages | ${ packageJsonCount } |\n`
142
- if ( dependencyFileCount > 0 )
143
- body += `| 🔧 System Dependencies | ${ dependencyFileCount } |\n`
144
- if ( githubActionsCount > 0 )
145
- body += `| 🚀 GitHub Actions | ${ githubActionsCount } |\n`
146
- if ( composerCount > 0 )
147
- body += `| 🐘 Composer Packages | ${ composerCount } |\n`
148
- body += `| **Total** | **${ group . updates . length } ** |\n\n`
160
+ // Only show summary table for multi-package updates
161
+ const isMultiPackageUpdate = group . updates . length > 1
162
+ if ( isMultiPackageUpdate ) {
163
+ body += `## Package Updates Summary\n\n`
164
+ body += `| Type | Count |\n`
165
+ body += `|------|-------|\n`
166
+ if ( packageJsonCount > 0 )
167
+ body += `| 📦 NPM Packages | ${ packageJsonCount } |\n`
168
+ if ( dependencyFileCount > 0 )
169
+ body += `| 🔧 System Dependencies | ${ dependencyFileCount } |\n`
170
+ if ( githubActionsCount > 0 )
171
+ body += `| 🚀 GitHub Actions | ${ githubActionsCount } |\n`
172
+ if ( composerCount > 0 )
173
+ body += `| 🐘 Composer Packages | ${ composerCount } |\n`
174
+ body += `| **Total** | **${ group . updates . length } ** |\n\n`
175
+ }
149
176
150
177
// Separate updates by type
151
178
const packageJsonUpdates = group . updates . filter ( update =>
@@ -217,12 +244,16 @@ export class PullRequestGenerator {
217
244
packageCount : packageJsonUpdates . length ,
218
245
packages : packageJsonUpdates . map ( u => u . name ) ,
219
246
} )
220
- body += `## 📦 npm Dependencies\n\n`
221
- body += `\n\n`
222
- if ( packageJsonUpdates . length === 1 ) {
223
- body += `* ${ packageJsonUpdates . length } package will be updated* \n\n`
247
+
248
+ // Only show section header for multi-package updates or when there are multiple package types
249
+ if ( isMultiPackageUpdate || packageJsonCount < group . updates . length ) {
250
+ body += `## 📦 npm Dependencies \n\n`
224
251
}
225
- else if ( packageJsonUpdates . length > 1 ) {
252
+
253
+ body += `\n\n`
254
+
255
+ // Only show count text for multi-package updates
256
+ if ( packageJsonUpdates . length > 1 ) {
226
257
body += `*${ packageJsonUpdates . length } packages will be updated*\n\n`
227
258
}
228
259
body += `| Package | Change | Age | Adoption | Passing | Confidence |\n`
@@ -301,12 +332,15 @@ export class PullRequestGenerator {
301
332
}
302
333
}
303
334
304
- body += `## 🐘 PHP/Composer Dependencies\n\n`
305
- body += `\n\n`
306
- if ( uniqueComposerUpdates . length === 1 ) {
307
- body += `*${ uniqueComposerUpdates . length } package will be updated*\n\n`
335
+ // Only show section header for multi-package updates or when there are multiple package types
336
+ if ( isMultiPackageUpdate || composerCount < group . updates . length ) {
337
+ body += `## 🐘 PHP/Composer Dependencies\n\n`
308
338
}
309
- else if ( uniqueComposerUpdates . length > 1 ) {
339
+
340
+ body += `\n\n`
341
+
342
+ // Only show count text for multi-package updates
343
+ if ( uniqueComposerUpdates . length > 1 ) {
310
344
body += `*${ uniqueComposerUpdates . length } packages will be updated*\n\n`
311
345
}
312
346
body += `| Package | Change | Age | Adoption | Passing | Confidence | Type | Update |\n`
@@ -354,14 +388,16 @@ export class PullRequestGenerator {
354
388
355
389
// Dependency files table (enhanced with more information)
356
390
if ( dependencyFileUpdates . length > 0 ) {
357
- body += `## 🔧 System Dependencies\n\n`
391
+ // Only show section header for multi-package updates or when there are multiple package types
392
+ if ( isMultiPackageUpdate || dependencyFileCount < group . updates . length ) {
393
+ body += `## 🔧 System Dependencies\n\n`
394
+ }
395
+
358
396
body += `\n\n`
359
397
398
+ // Only show count text for multi-package updates
360
399
const uniqueFiles = [ ...new Set ( dependencyFileUpdates . map ( u => u . file ) ) ]
361
- if ( dependencyFileUpdates . length === 1 ) {
362
- body += `*${ dependencyFileUpdates . length } package will be updated in \`${ uniqueFiles [ 0 ] . split ( '/' ) . pop ( ) } \`*\n\n`
363
- }
364
- else if ( dependencyFileUpdates . length > 1 ) {
400
+ if ( dependencyFileUpdates . length > 1 ) {
365
401
body += `*${ dependencyFileUpdates . length } packages will be updated across ${ uniqueFiles . length } file(s): ${ uniqueFiles . map ( f => `\`${ f . split ( '/' ) . pop ( ) } \`` ) . join ( ', ' ) } *\n\n`
366
402
}
367
403
@@ -397,13 +433,15 @@ export class PullRequestGenerator {
397
433
398
434
// GitHub Actions table (enhanced with more information)
399
435
if ( uniqueGithubActionsUpdates . length > 0 ) {
400
- body += `## 🚀 GitHub Actions\n\n`
436
+ // Only show section header for multi-package updates or when there are multiple package types
437
+ if ( isMultiPackageUpdate || githubActionsCount < group . updates . length ) {
438
+ body += `## 🚀 GitHub Actions\n\n`
439
+ }
440
+
401
441
body += `\n\n`
402
442
403
- if ( uniqueGithubActionsUpdates . length === 1 ) {
404
- body += `*${ uniqueGithubActionsUpdates . length } action will be updated*\n\n`
405
- }
406
- else if ( uniqueGithubActionsUpdates . length > 1 ) {
443
+ // Only show count text for multi-action updates
444
+ if ( uniqueGithubActionsUpdates . length > 1 ) {
407
445
body += `*${ uniqueGithubActionsUpdates . length } actions will be updated*\n\n`
408
446
}
409
447
0 commit comments