mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2026-04-16 19:15:43 +00:00
Fix: Ignore other users' comments (#332)
Make findPreviousComment only return comments made by the current user (usually github-actions[bot])
This commit is contained in:
parent
2020b5bc34
commit
65b0a353cc
5 changed files with 309 additions and 283 deletions
|
|
@ -14,12 +14,15 @@ export async function findPreviousComment(
|
|||
issue_number: number,
|
||||
header: string
|
||||
): Promise<{body?: string; id: number} | undefined> {
|
||||
const {viewer} = await octokit.graphql("query { viewer { login } }")
|
||||
const {data: comments} = await octokit.rest.issues.listComments({
|
||||
...repo,
|
||||
issue_number
|
||||
})
|
||||
const h = headerComment(header)
|
||||
return comments.find(comment => comment.body?.includes(h))
|
||||
return comments.find(
|
||||
comment => comment.user?.login === viewer.login && comment.body?.includes(h)
|
||||
)
|
||||
}
|
||||
export async function updateComment(
|
||||
octokit: InstanceType<typeof GitHub>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue