@@ -55,8 +55,8 @@ export default async function success(pluginConfig, context, { Octokit }) {
55
55
56
56
const errors = [ ] ;
57
57
58
- if ( successComment === false ) {
59
- logger . log ( "Skip commenting on issues and pull requests." ) ;
58
+ if ( successComment === false && releasedLabels === false ) {
59
+ logger . log ( "Skip commenting / adding labels on issues and pull requests." ) ;
60
60
} else {
61
61
const parser = issueParser (
62
62
"github" ,
@@ -134,20 +134,21 @@ export default async function success(pluginConfig, context, { Octokit }) {
134
134
135
135
await Promise . all (
136
136
uniqBy ( [ ...prs , ...issues ] , "number" ) . map ( async ( issue ) => {
137
- const body = successComment
138
- ? template ( successComment ) ( { ...context , issue } )
139
- : getSuccessComment ( issue , releaseInfos , nextRelease ) ;
140
137
try {
141
- const comment = { owner, repo, issue_number : issue . number , body } ;
142
- debug ( "create comment: %O" , comment ) ;
143
- const {
144
- data : { html_url : url } ,
145
- } = await octokit . request (
146
- "POST /repos/{owner}/{repo}/issues/{issue_number}/comments" ,
147
- comment ,
148
- ) ;
149
- logger . log ( "Added comment to issue #%d: %s" , issue . number , url ) ;
150
-
138
+ if ( successComment !== false ) {
139
+ const body = successComment
140
+ ? template ( successComment ) ( { ...context , issue } )
141
+ : getSuccessComment ( issue , releaseInfos , nextRelease ) ;
142
+ const comment = { owner, repo, issue_number : issue . number , body } ;
143
+ debug ( "create comment: %O" , comment ) ;
144
+ const {
145
+ data : { html_url : url } ,
146
+ } = await octokit . request (
147
+ "POST /repos/{owner}/{repo}/issues/{issue_number}/comments" ,
148
+ comment ,
149
+ ) ;
150
+ logger . log ( "Added comment to issue #%d: %s" , issue . number , url ) ;
151
+ }
151
152
if ( releasedLabels ) {
152
153
const labels = releasedLabels . map ( ( label ) =>
153
154
template ( label ) ( context ) ,
@@ -166,18 +167,18 @@ export default async function success(pluginConfig, context, { Octokit }) {
166
167
} catch ( error ) {
167
168
if ( error . status === 403 ) {
168
169
logger . error (
169
- "Not allowed to add a comment to the issue #%d." ,
170
+ "Not allowed to add comment/label to the issue #%d." ,
170
171
issue . number ,
171
172
) ;
172
173
} else if ( error . status === 404 ) {
173
174
logger . error (
174
- "Failed to add a comment to the issue #%d as it doesn't exist." ,
175
+ "Failed to add comment/label to the issue #%d as it doesn't exist." ,
175
176
issue . number ,
176
177
) ;
177
178
} else {
178
179
errors . push ( error ) ;
179
180
logger . error (
180
- "Failed to add a comment to the issue #%d." ,
181
+ "Failed to add comment/label to the issue #%d." ,
181
182
issue . number ,
182
183
) ;
183
184
// Don't throw right away and continue to update other issues
0 commit comments