Skip to content

Commit

Permalink
ci(link-check): mark outdated link check comments as such
Browse files Browse the repository at this point in the history
In particular with long-running issues where links are broken for weeks
(and over the course of dozens of git-scm.com deployments), while it is
nice that the link checker adds the most recent "verdict", the previous
ones are no longer _that_ interesting. Let's hide them.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Mar 6, 2025
1 parent 3368db3 commit 64e26f8
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 64e26f8

Please sign in to comment.