mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-12 11:41:14 +00:00
✅ Fix failed tests
This commit is contained in:
parent
ec21df156a
commit
182fb2a468
2 changed files with 5 additions and 4 deletions
|
|
@ -142,7 +142,7 @@ describe("updateComment", () => {
|
|||
expect(octokit.graphql).toBeCalledWith(expect.any(String), {
|
||||
input: {
|
||||
id: "456",
|
||||
body: "hello there\n<!-- Sticky Pull Request CommentTypeA -->\nhello there"
|
||||
body: "hello there\nhello there\n<!-- Sticky Pull Request CommentTypeA -->"
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ function bodyWithHeader(body: string, header: string): string {
|
|||
}
|
||||
|
||||
function bodyWithoutHeader(body: string, header: string): string {
|
||||
return body.replace(`\n${headerComment(header)}`, "");
|
||||
return body.replace(`\n${headerComment(header)}`, "")
|
||||
}
|
||||
|
||||
export async function findPreviousComment(
|
||||
|
|
@ -92,8 +92,9 @@ export async function updateComment(
|
|||
if (!body && !previousBody)
|
||||
return core.warning("Comment body cannot be blank")
|
||||
|
||||
if (previousBody)
|
||||
let rawPreviousBody = bodyWithoutHeader(previousBody, header)
|
||||
const rawPreviousBody: String = previousBody
|
||||
? bodyWithoutHeader(previousBody, header)
|
||||
: ""
|
||||
|
||||
await octokit.graphql(
|
||||
`
|
||||
|
|
|
|||
Loading…
Reference in a new issue