File tree 1 file changed +39
-0
lines changed
.github/actions/deploy-to-github-pages
1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,45 @@ runs:
222
222
await github.rest.issues.createComment({ ...req, body })
223
223
if ('${{ steps.lychee.outputs.exit_code }}' === '0') {
224
224
await github.rest.issues.update({ ...req, state: 'closed' })
225
+ } else {
226
+ // minimize outdated comments, if any
227
+ const query = `query ($owner: String!, $repo: String!, $issue_number: Int!) {
228
+ repository(owner: $owner, name: $repo) {
229
+ issue(number: $issue_number) {
230
+ comments(first: 100) {
231
+ nodes {
232
+ id
233
+ isMinimized
234
+ minimizedReason
235
+ body
236
+ author {
237
+ login
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }
243
+ }`
244
+ const commentIds = (await github.graphql(query, req)).repository.issue.comments.nodes
245
+ commentIds.pop() // leave the just-created comment alone
246
+ const markOutdatedCommentMutation = `mutation ($id: ID!, $classifier: ReportedContentClassifiers!) {
247
+ minimizeComment(input: { subjectId: $id, classifier: $classifier }) {
248
+ clientMutationId
249
+ minimizedComment {
250
+ isMinimized
251
+ minimizedReason
252
+ viewerCanMinimize
253
+ }
254
+ }
255
+ }`
256
+ for (const outdatedComment of commentIds.filter(
257
+ comment => comment.author.login === 'github-actions' && comment.isMinimized === false
258
+ )) {
259
+ await github.graphql(markOutdatedCommentMutation, {
260
+ id: outdatedComment.id,
261
+ classifier: 'OUTDATED',
262
+ })
263
+ }
225
264
}
226
265
}
227
266
You can’t perform that action at this time.
0 commit comments