Skip to content

Commit

Permalink
check comment ids
Browse files Browse the repository at this point in the history
  • Loading branch information
tnyo43 committed Mar 3, 2024
1 parent 5703eb8 commit 91cb240
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
14 changes: 8 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 19 additions & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,31 @@ export async function run(): Promise<void> {

core.debug(`owner: ${owner}, repo: ${repo}, PR #${pullRequest.number}`)

const comments = await octokit.rest.issues.listComments({
owner,
repo,
issue_number: pullRequest.number
})
const reviewComments = await octokit.rest.pulls.listReviewComments({
owner,
repo,
pull_number: pullRequest.number
})
const comments = (
await octokit.rest.issues.listComments({
owner,
repo,
issue_number: pullRequest.number
})
).data.filter(comment => comment.user?.id === context.runId)

const reviewComments = (
await octokit.rest.pulls.listReviewComments({
owner,
repo,
pull_number: pullRequest.number
})
).data

await octokit.rest.issues.createComment({
owner,
repo,
issue_number: pullRequest.number,
body: `the number of the comments is ${comments.data.length}\ncontents: \n${comments.data.map(c => `- ${c.user?.name}, ${c.body}`).join('\n')}
body: `run id: ${context.runId}
the number of the comments is ${comments.length}\ncontents: \n${comments.map(c => `- ${c.user?.id}, ${c.body}`).join('\n')}
the number of the review comments is ${reviewComments.data.length}\ncontents: \n${reviewComments.data.map(c => `- ${c.user?.name}, ${c.body}`).join('\n')}`
the number of the review comments is ${reviewComments.length}\ncontents: \n${reviewComments.map(c => `- ${c.user?.id}, ${c.body}`).join('\n')}`
})
core.debug(`Commented on PR #${pullRequest.number}`)
} catch (error) {
Expand Down

0 comments on commit 91cb240

Please sign in to comment.