Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
thollander committed Aug 6, 2023
1 parent acc95a6 commit 7ec7be9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/cleanup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9561,12 +9561,13 @@ async function run() {
}
const comment_tag_pattern = `<!-- thollander/actions-comment-pull-request "${comment_tag}" -->`;
if (comment_tag_pattern) {
let comments = [];
const comments = [];
for await (const { data: comments } of octokit.paginate.iterator(octokit.rest.issues.listComments, {
...context.repo,
issue_number,
})) {
comments.push(...comments.filter((comment) => comment?.body?.includes(comment_tag_pattern)));
const commentsToDelete = comments.filter((comment) => comment?.body?.includes(comment_tag_pattern));
commentsToDelete.forEach(commentToDelete => comments.push(commentToDelete));
}
if (comments.length > 0) {
for (const comment of comments) {
Expand Down
5 changes: 3 additions & 2 deletions src/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ async function run() {
type ListCommentsResponseDataType = GetResponseDataTypeFromEndpointMethod<
typeof octokit.rest.issues.listComments
>;
let comments: ListCommentsResponseDataType = [];
const comments: ListCommentsResponseDataType[0][] = [];
for await (const { data: comments } of octokit.paginate.iterator(octokit.rest.issues.listComments, {
...context.repo,
issue_number,
})) {
comments.push(...comments.filter((comment) => comment?.body?.includes(comment_tag_pattern)));
const commentsToDelete = comments.filter((comment) => comment?.body?.includes(comment_tag_pattern));
commentsToDelete.forEach(commentToDelete => comments.push(commentToDelete));
}

if (comments.length > 0) {
Expand Down

0 comments on commit 7ec7be9

Please sign in to comment.