X Tutup
Skip to content

Commit cfbdc40

Browse files
ckerrJohn Kleinschmidt
authored andcommitted
fix: release-notes plays more nicely with clerk (electron#16887)
Explicitly look not just for Clerk's "notes persisted" message but also its "no release notes" message.
1 parent 83894dc commit cfbdc40

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

script/release-notes/notes.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,27 @@ const getNoteFromClerk = async (number, owner, repo) => {
5656
if (!comments || !comments.data) return
5757

5858
const CLERK_LOGIN = 'release-clerk[bot]'
59+
const CLERK_NO_NOTES = '**No Release Notes**'
5960
const PERSIST_LEAD = '**Release Notes Persisted**\n\n'
6061
const QUOTE_LEAD = '> '
6162

6263
for (const comment of comments.data.reverse()) {
6364
if (comment.user.login !== CLERK_LOGIN) {
6465
continue
6566
}
66-
if (!comment.body.startsWith(PERSIST_LEAD)) {
67-
continue
67+
if (comment.body === CLERK_NO_NOTES) {
68+
return NO_NOTES
69+
}
70+
if (comment.body.startsWith(PERSIST_LEAD)) {
71+
return comment.body
72+
.slice(PERSIST_LEAD.length).trim() // remove PERSIST_LEAD
73+
.split('\r?\n') // break into lines
74+
.map(line => line.trim())
75+
.filter(line => line.startsWith(QUOTE_LEAD)) // notes are quoted
76+
.map(line => line.slice(QUOTE_LEAD.length)) // unquote the lines
77+
.join(' ') // join the note lines
78+
.trim()
6879
}
69-
const note = comment.body
70-
.slice(PERSIST_LEAD.length).trim() // remove PERSIST_LEAD
71-
.split('\r?\n') // break into lines
72-
.map(line => line.trim())
73-
.filter(line => line.startsWith(QUOTE_LEAD)) // notes are quoted
74-
.map(line => line.slice(QUOTE_LEAD.length)) // unquote the lines
75-
.join(' ') // join the note lines
76-
.trim()
77-
return note
7880
}
7981
}
8082

0 commit comments

Comments
 (0)
X Tutup