Skip to content

Commit

Permalink
Merge pull request #1970 from dscho/mark-outdated-link-checker-comments
Browse files Browse the repository at this point in the history
ci(link-check): mark outdated link check comments as such
  • Loading branch information
dscho authored Mar 10, 2025
2 parents 3368db3 + 64e26f8 commit 00fc134
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/actions/deploy-to-github-pages/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,45 @@ runs:
await github.rest.issues.createComment({ ...req, body })
if ('${{ steps.lychee.outputs.exit_code }}' === '0') {
await github.rest.issues.update({ ...req, state: 'closed' })
} else {
// minimize outdated comments, if any
const query = `query ($owner: String!, $repo: String!, $issue_number: Int!) {
repository(owner: $owner, name: $repo) {
issue(number: $issue_number) {
comments(first: 100) {
nodes {
id
isMinimized
minimizedReason
body
author {
login
}
}
}
}
}
}`
const commentIds = (await github.graphql(query, req)).repository.issue.comments.nodes
commentIds.pop() // leave the just-created comment alone
const markOutdatedCommentMutation = `mutation ($id: ID!, $classifier: ReportedContentClassifiers!) {
minimizeComment(input: { subjectId: $id, classifier: $classifier }) {
clientMutationId
minimizedComment {
isMinimized
minimizedReason
viewerCanMinimize
}
}
}`
for (const outdatedComment of commentIds.filter(
comment => comment.author.login === 'github-actions' && comment.isMinimized === false
)) {
await github.graphql(markOutdatedCommentMutation, {
id: outdatedComment.id,
classifier: 'OUTDATED',
})
}
}
}
Expand Down

0 comments on commit 00fc134

Please sign in to comment.