in index.js [562:595]
async function minimizeComment(context, commentText, classifier) {
const comments = (await context.octokit.issues.listComments(context.issue())).data;
const comment = comments.find(comment => comment.user.type === 'Bot' && comment.body === commentText);
if (!comment) {
return;
}
try {
const res = await context.octokit.graphql(
`
mutation minimizeComment($id: ID!, $classifier: ReportedContentClassifiers!) {
minimizeComment(input: { subjectId: $id, classifier: $classifier }) {
clientMutationId
minimizedComment {
isMinimized
minimizedReason
viewerCanMinimize
}
}
}
`,
{
id: comment.node_id,
classifier: classifier || 'OUTDATED'
}
);
logger.info('minimize comment result: \n' + JSON.stringify(res, null, 2));
} catch (e) {
if (e instanceof GraphqlResponseError) {
logger.error('GraphQL Request Failed');
logger.error(JSON.stringify(e.request, null, 2));
}
logger.error(e);
}
}