Skip to content

Commit 175c99e

Browse files
committed
minimize previous comments
1 parent bb78e87 commit 175c99e

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

dist/index.js

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { count } from "console";
21
import { readdirSync, readFileSync } from "fs";
32
import { App } from "octokit";
43

@@ -166,6 +165,25 @@ body ??= generateTable(matrix);
166165
console.log("body is", body);
167166

168167
if (body) {
168+
console.log("outdates previous comments");
169+
const { data: comments } = await octokit.rest.issues.listComments({
170+
owner,
171+
repo,
172+
issue_number: pull_request_number,
173+
});
174+
for (const comment of comments) {
175+
console.log(comment.user?.id, comment.user?.name);
176+
if (appId === comment.user?.id) {
177+
await octokit.graphql(`
178+
mutation {
179+
minimizeComment(input: { subjectId: "${comment.node_id}", classifier: OUTDATED }) {
180+
181+
}
182+
}
183+
`);
184+
}
185+
}
186+
169187
console.log("leaving comment");
170188
octokit.rest.issues.createComment({
171189
owner,

0 commit comments

Comments
 (0)