MCPcopy Index your code
hub / github.com/nodejs/nodejs.org / fetchChangelog

Function fetchChangelog

apps/site/scripts/release-post/index.mjs:139–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137};
138
139const fetchChangelog = version => {
140 const parts = version.split('.');
141 const releaseLine = parts[0] === '0' ? parts.slice(0, 2).join('') : parts[0];
142
143 return request({ url: URLS.NODE_CHANGELOG_MD(releaseLine) }).then(data => {
144 // matches a complete release section
145 const rxSection = new RegExp(
146 `<a id="${version}"></a>\\n([\\s\\S]+?)(?:\\n<a id="|$)`
147 );
148
149 const matches = rxSection.exec(data);
150
151 return new Promise((resolve, reject) =>
152 matches && matches.length && matches[1]
153 ? resolve(matches[1].trim())
154 : reject(ERRORS.NO_CHANGELOG_FOUND(version))
155 );
156 });
157};
158
159const fetchChangelogBody = version => {
160 return fetchChangelog(version).then(section => {

Callers 3

fetchAuthorFunction · 0.85
fetchChangelogBodyFunction · 0.85
fetchVersionPolicyFunction · 0.85

Calls 2

requestFunction · 0.85
resolveFunction · 0.85

Tested by

no test coverage detected