Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(link-check): mark outdated link check comments as such #1970

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading