mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-19 10:15:59 +08:00
fix: list comment page lost in [find-comments] (#66)
* fix: list comment page lost in [find-comments] * add changelog
This commit is contained in:
22
dist/index.js
vendored
22
dist/index.js
vendored
@@ -7802,14 +7802,10 @@ async function doCloseIssues(owner, repo, labels) {
|
||||
}
|
||||
|
||||
async function doFindComments(owner, repo, issueNumber) {
|
||||
const res = await octokit.issues.listComments({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
});
|
||||
const commentList = await listComments(owner, repo, issueNumber);
|
||||
core.info(`Actions: [find-comments][${issueNumber}] success!`);
|
||||
let comments = [];
|
||||
res.data.forEach(item => {
|
||||
commentList.forEach(item => {
|
||||
const a = commentAuth ? item.user.login === commentAuth : true;
|
||||
const b = bodyIncludes ? item.body.includes(bodyIncludes) : true;
|
||||
if (a && b) {
|
||||
@@ -7829,6 +7825,20 @@ async function doFindComments(owner, repo, issueNumber) {
|
||||
core.info(`out-comments: ${JSON.stringify(comments)}`);
|
||||
}
|
||||
|
||||
async function listComments(owner, repo, issueNumber, page = 1) {
|
||||
let { data: comments } = await octokit.issues.listComments({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
per_page: 100,
|
||||
page,
|
||||
});
|
||||
if (comments.length >= 100) {
|
||||
comments = comments.concat(await listComments(page + 1));
|
||||
}
|
||||
return comments;
|
||||
}
|
||||
|
||||
async function doLockIssues(owner, repo, labels) {
|
||||
const issues = await doQueryIssues(owner, repo, labels, issueState);
|
||||
|
||||
|
Reference in New Issue
Block a user