fix: corrected limit for drawing comments
All checks were successful
Dependabot Auto-Merge / dependabot (pull_request) Has been skipped
Dependabot Auto-Merge / devopsbot (pull_request) Has been skipped
Dependabot Auto-Merge / rennovatebot (pull_request) Has been skipped
Unit Tests / unittest (pull_request) Successful in 48s
COMMIT LINT / commitlint (pull_request) Successful in 1m30s
All checks were successful
Dependabot Auto-Merge / dependabot (pull_request) Has been skipped
Dependabot Auto-Merge / devopsbot (pull_request) Has been skipped
Dependabot Auto-Merge / rennovatebot (pull_request) Has been skipped
Unit Tests / unittest (pull_request) Successful in 48s
COMMIT LINT / commitlint (pull_request) Successful in 1m30s
This commit is contained in:
17
dist/index.js
vendored
17
dist/index.js
vendored
@@ -32861,7 +32861,7 @@ const serverUrl = (
|
|||||||
async function issueComments() {
|
async function issueComments() {
|
||||||
if (!repoFullName || !issueNumber) return null;
|
if (!repoFullName || !issueNumber) return null;
|
||||||
|
|
||||||
const url = `${serverUrl}/api/v1/repos/${repoFullName}/issues/${issueNumber}/comments?limit=1`;
|
const url = `${serverUrl}/api/v1/repos/${repoFullName}/issues/${issueNumber}/comments?limit=30`;
|
||||||
const headers = { Accept: "application/vnd.github+json" };
|
const headers = { Accept: "application/vnd.github+json" };
|
||||||
|
|
||||||
if (githubToken) {
|
if (githubToken) {
|
||||||
@@ -32880,7 +32880,20 @@ async function issueComments() {
|
|||||||
const comments = await response.json();
|
const comments = await response.json();
|
||||||
if (!Array.isArray(comments) || comments.length === 0) return null;
|
if (!Array.isArray(comments) || comments.length === 0) return null;
|
||||||
|
|
||||||
return comments.map((v) => v.body);
|
const sortedComments = comments
|
||||||
|
.slice()
|
||||||
|
.sort((a, b) => {
|
||||||
|
if (a?.created_at && b?.created_at) {
|
||||||
|
return new Date(a.created_at) - new Date(b.created_at);
|
||||||
|
}
|
||||||
|
if (Number.isFinite(a?.id) && Number.isFinite(b?.id)) {
|
||||||
|
return a.id - b.id;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
})
|
||||||
|
.map((v) => v.body);
|
||||||
|
|
||||||
|
return sortedComments;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.warning(`Error fetching issue comments: ${error}`);
|
core.warning(`Error fetching issue comments: ${error}`);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
17
index.js
17
index.js
@@ -29,7 +29,7 @@ const serverUrl = (
|
|||||||
async function issueComments() {
|
async function issueComments() {
|
||||||
if (!repoFullName || !issueNumber) return null;
|
if (!repoFullName || !issueNumber) return null;
|
||||||
|
|
||||||
const url = `${serverUrl}/api/v1/repos/${repoFullName}/issues/${issueNumber}/comments?limit=1`;
|
const url = `${serverUrl}/api/v1/repos/${repoFullName}/issues/${issueNumber}/comments?limit=30`;
|
||||||
const headers = { Accept: "application/vnd.github+json" };
|
const headers = { Accept: "application/vnd.github+json" };
|
||||||
|
|
||||||
if (githubToken) {
|
if (githubToken) {
|
||||||
@@ -48,7 +48,20 @@ async function issueComments() {
|
|||||||
const comments = await response.json();
|
const comments = await response.json();
|
||||||
if (!Array.isArray(comments) || comments.length === 0) return null;
|
if (!Array.isArray(comments) || comments.length === 0) return null;
|
||||||
|
|
||||||
return comments.map((v) => v.body);
|
const sortedComments = comments
|
||||||
|
.slice()
|
||||||
|
.sort((a, b) => {
|
||||||
|
if (a?.created_at && b?.created_at) {
|
||||||
|
return new Date(a.created_at) - new Date(b.created_at);
|
||||||
|
}
|
||||||
|
if (Number.isFinite(a?.id) && Number.isFinite(b?.id)) {
|
||||||
|
return a.id - b.id;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
})
|
||||||
|
.map((v) => v.body);
|
||||||
|
|
||||||
|
return sortedComments;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.warning(`Error fetching issue comments: ${error}`);
|
core.warning(`Error fetching issue comments: ${error}`);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user