Skip to content

Commit 5993c39

Browse files
authored
Merge pull request #28 from CryogenicBot/preserve-checklist-state
Adding Null Check for Existing Comment
2 parents e57fd65 + 705a53a commit 5993c39

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19269,7 +19269,7 @@ function run() {
1926919269
if (applicableChecklistPaths.length > 0) {
1927019270
const body = [
1927119271
`${header}\n\n`,
19272-
...applicableChecklistPaths.map(([path, items]) => formatItemsForPath(existingComment.body, [path, items])),
19272+
...applicableChecklistPaths.map(([path, items]) => formatItemsForPath(!!existingComment ? existingComment.body : undefined, [path, items])),
1927319273
`\n${footer}`,
1927419274
].join("");
1927519275
if (existingComment) {

index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ async function run() {
103103
const body = [
104104
`${header}\n\n`,
105105
...applicableChecklistPaths.map(([path, items]) =>
106-
formatItemsForPath(existingComment.body, [path, items])
106+
formatItemsForPath(
107+
!!existingComment ? existingComment.body : undefined,
108+
[path, items]
109+
)
107110
),
108111
`\n${footer}`,
109112
].join("");

0 commit comments

Comments
 (0)