Skip to content

Commit e228b32

Browse files
lpincastevemao
authored andcommitted
Make the release-post script more tolerant (#838)
Fixes: #837
1 parent 9b8861e commit e228b32

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎scripts/release-post.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function fetchChangelog (version) {
103103
const rxSection = new RegExp(`<a id="${version}"></a>\\n([\\s\\S]+?)(?:\\n<a id="|$)`)
104104
const matches = rxSection.exec(data)
105105
return matches
106-
? matches[1]
106+
? matches[1].trim()
107107
: Promise.reject(new Error(`Couldn't find matching changelog for ${version}`))
108108
})
109109
}

‎tests/scripts/release-post.test.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ test('fetchChangelog(<version>)', (t) => {
117117
.replyWithFile(200, changelogFixture)
118118

119119
releasePost.fetchChangelog('4.1.1').then((changelog) => {
120+
t.true(changelog.charAt(changelog.length - 1) !== '\n')
121+
t.true(changelog.charAt(0) !== '\n')
120122
t.true(changelog.includes('Fixed a bug introduced in v4.1.0'))
121123
t.true(github.isDone(), 'githubusercontent.com was requested')
122124

0 commit comments

Comments
 (0)