Fix sync-react changelog (#66532)

This commit is contained in:
Sebastian Silbermann 2024-06-05 18:57:33 +02:00 committed by GitHub
parent 3445a562aa
commit b6a45eba45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -204,7 +204,7 @@ function extractInfoFromReactVersion(reactVersion) {
async function getChangelogFromGitHub(baseSha, newSha) { async function getChangelogFromGitHub(baseSha, newSha) {
const pageSize = 50 const pageSize = 50
let changelog = [] let changelog = []
for (let currentPage = 0; ; currentPage++) { for (let currentPage = 1; ; currentPage++) {
const url = `https://api.github.com/repos/facebook/react/compare/${baseSha}...${newSha}?per_page=${pageSize}&page=${currentPage}` const url = `https://api.github.com/repos/facebook/react/compare/${baseSha}...${newSha}?per_page=${pageSize}&page=${currentPage}`
const headers = {} const headers = {}
// GITHUB_TOKEN is optional but helps in case of rate limiting during development. // GITHUB_TOKEN is optional but helps in case of rate limiting during development.
@ -221,10 +221,7 @@ async function getChangelogFromGitHub(baseSha, newSha) {
} }
const data = await response.json() const data = await response.json()
const { base_commit, commits } = data const { commits } = data
if (currentPage === 0) {
commits.unshift(base_commit)
}
for (const { commit, sha } of commits) { for (const { commit, sha } of commits) {
const title = commit.message.split('\n')[0] || '' const title = commit.message.split('\n')[0] || ''
const match = const match =