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 4e27e54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/cleanup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9561,13 +9561,15 @@ 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));
}
console.log('comments', comments);
if (comments.length > 0) {
for (const comment of comments) {
core.info(`Deleting comment ${comment.id}.`);
Expand Down
6 changes: 4 additions & 2 deletions src/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ async function run() {
type ListCommentsResponseDataType = GetResponseDataTypeFromEndpointMethod<
typeof octokit.rest.issues.listComments
>;
let comments: ListCommentsResponseDataType = [];
const comments: ListCommentsResponseDataType = [];
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));
}

console.log('comments', comments);
if (comments.length > 0) {
for (const comment of comments) {
core.info(`Deleting comment ${comment.id}.`);
Expand Down

0 comments on commit 4e27e54

Please sign in to comment.