@@ -206,93 +206,6 @@ await client.Issue.Comment.Create(
206
206
}
207
207
}
208
208
209
- async Task PostCommentToPullRequest ( int prNumber , string markdown )
210
- {
211
- Console . WriteLine ( "Posting comment to GitHub" ) ;
212
-
213
- // post directly to GitHub as
214
- var httpClient = new HttpClient ( ) ;
215
- httpClient . DefaultRequestHeaders . Add ( "Accept" , "application/vnd.github.v3+json" ) ;
216
- httpClient . DefaultRequestHeaders . Add ( "Authorization" , $ "token { GitHubToken } ") ;
217
- httpClient . DefaultRequestHeaders . UserAgent . Add ( new ( new System . Net . Http . Headers . ProductHeaderValue ( "nuke-ci-client" ) ) ) ;
218
-
219
- var url = $ "https://api.github.com/repos/{ GitHubRepositoryOwner } /{ GitHubRepositoryName } /issues/{ prNumber } /comments";
220
- Console . WriteLine ( $ "Sending request to '{ url } '") ;
221
-
222
- var result = await httpClient . PostAsJsonAsync ( url , new { body = markdown } ) ;
223
-
224
- if ( result . IsSuccessStatusCode )
225
- {
226
- Console . WriteLine ( "Comment posted successfully" ) ;
227
- }
228
- else
229
- {
230
- var response = await result . Content . ReadAsStringAsync ( ) ;
231
- Console . WriteLine ( "Error: " + response ) ;
232
- result . EnsureSuccessStatusCode ( ) ;
233
- }
234
- }
235
-
236
- async Task HideCommentsInPullRequest ( int prNumber , string prefix )
237
- {
238
- try
239
- {
240
- Console . WriteLine ( "Looking for comments to hide in GitHub" ) ;
241
-
242
- var clientId = "nuke-ci-client" ;
243
- var productInformation = Octokit . GraphQL . ProductHeaderValue . Parse ( clientId ) ;
244
- var connection = new Octokit . GraphQL . Connection ( productInformation , GitHubToken ) ;
245
-
246
- var query = new Octokit . GraphQL . Query ( )
247
- . Repository ( GitHubRepositoryName , GitHubRepositoryOwner )
248
- . PullRequest ( prNumber )
249
- . Comments ( )
250
- . AllPages ( )
251
- . Select ( issue => new { issue . Id , issue . Body , issue . IsMinimized , } ) ;
252
-
253
- var issueComments = ( await connection . Run ( query ) ) . ToList ( ) ;
254
-
255
- Console . WriteLine ( $ "Found { issueComments } comments for PR { prNumber } ") ;
256
-
257
- var count = 0 ;
258
- foreach ( var issueComment in issueComments )
259
- {
260
- if ( issueComment . IsMinimized || ! issueComment . Body . StartsWith ( prefix ) )
261
- {
262
- continue ;
263
- }
264
-
265
- try
266
- {
267
- var arg = new MinimizeCommentInput
268
- {
269
- Classifier = ReportedContentClassifiers . Outdated ,
270
- SubjectId = issueComment . Id ,
271
- ClientMutationId = clientId
272
- } ;
273
-
274
- var mutation = new Mutation ( )
275
- . MinimizeComment ( arg )
276
- . Select ( x => new { x . MinimizedComment . IsMinimized } ) ;
277
-
278
- await connection . Run ( mutation ) ;
279
- count ++ ;
280
-
281
- }
282
- catch ( Exception ex )
283
- {
284
- Logger . Warning ( $ "Error minimising comment with ID { issueComment . Id } : { ex } ") ;
285
- }
286
- }
287
-
288
- Console . WriteLine ( $ "Minimised { count } comments for PR { prNumber } ") ;
289
- }
290
- catch ( Exception ex )
291
- {
292
- Logger . Warning ( $ "There was an error trying to minimise old comments with prefix '{ prefix } ': { ex } ") ;
293
- }
294
- }
295
-
296
209
Target AssignLabelsToPullRequest => _ => _
297
210
. Unlisted ( )
298
211
. Requires ( ( ) => GitHubRepositoryName )
0 commit comments