@@ -71,10 +71,12 @@ func CombinePRsWithStats(ctx context.Context, graphQlClient *api.GraphQLClient,
71
71
}
72
72
}
73
73
74
+ combinedPrNumbers := []string {}
74
75
for _ , pr := range opts .Pulls {
75
76
if opts .Noop {
76
77
Logger .Debug ("Simulating merge of branch" , "branch" , pr .Head .Ref )
77
78
combined = append (combined , fmt .Sprintf ("#%d - %s" , pr .Number , pr .Title ))
79
+ combinedPrNumbers = append (combinedPrNumbers , fmt .Sprintf ("#%d" , pr .Number ))
78
80
} else {
79
81
err := mergeBranch (ctx , restClient , opts .Repo , workingBranchName , pr .Head .Ref )
80
82
if err != nil {
@@ -87,6 +89,7 @@ func CombinePRsWithStats(ctx context.Context, graphQlClient *api.GraphQLClient,
87
89
} else {
88
90
Logger .Debug ("Merged branch" , "branch" , pr .Head .Ref )
89
91
combined = append (combined , fmt .Sprintf ("#%d - %s" , pr .Number , pr .Title ))
92
+ combinedPrNumbers = append (combinedPrNumbers , fmt .Sprintf ("#%d" , pr .Number ))
90
93
}
91
94
}
92
95
}
@@ -102,7 +105,7 @@ func CombinePRsWithStats(ctx context.Context, graphQlClient *api.GraphQLClient,
102
105
Logger .Warn ("Failed to delete working branch" , "branch" , workingBranchName , "error" , err )
103
106
}
104
107
105
- prBody := generatePRBody (combined , mergeConflicts , opts .Command )
108
+ prBody := generatePRBody (combinedPrNumbers , mergeConflicts , opts .Command )
106
109
prTitle := "Combined PRs"
107
110
prNumber , prErr := createPullRequestWithNumber (ctx , restClient , opts .Repo , prTitle , combineBranchName , repoDefaultBranch , prBody , addLabels , addAssignees )
108
111
if prErr != nil {
@@ -200,12 +203,19 @@ func getBranchSHA(ctx context.Context, client RESTClientInterface, repo github.R
200
203
return ref .Object .SHA , nil
201
204
}
202
205
203
- // Updated generatePRBody to include the command used
204
- func generatePRBody (combinedPRs , mergeFailedPRs []string , command string ) string {
206
+ // Updated generatePRBody to include the command used and handle PR autoclose logic
207
+ // combinedPrNumbers looks like ["#1", "#2"]
208
+ // mergeFailedPRs looks like ["#3", "#4"]
209
+ func generatePRBody (combinedPrNumbers []string , mergeFailedPRs []string , command string ) string {
205
210
body := "✅ The following pull requests have been successfully combined:\n "
206
- for _ , pr := range combinedPRs {
207
- body += "- " + pr + "\n "
211
+ for _ , prNumber := range combinedPrNumbers {
212
+ prRef := prNumber
213
+ if ! noAutoclose {
214
+ prRef = "closes: " + prNumber
215
+ }
216
+ body += "- " + prRef + "\n "
208
217
}
218
+
209
219
if len (mergeFailedPRs ) > 0 {
210
220
body += "\n ⚠️ The following pull requests could not be merged due to conflicts:\n "
211
221
for _ , pr := range mergeFailedPRs {
0 commit comments