Skip to content

Commit

Permalink
Fix sync-react changelog
Browse files Browse the repository at this point in the history
Seems like their API either changed or broke.

But page 0 and 1 are now equal.
We also no longer need to include the base.
  • Loading branch information
eps1lon committed Jun 4, 2024
1 parent 3d4ab35 commit 1a18b1a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions scripts/sync-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function extractInfoFromReactVersion(reactVersion) {
async function getChangelogFromGitHub(baseSha, newSha) {
const pageSize = 50
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 headers = {}
// GITHUB_TOKEN is optional but helps in case of rate limiting during development.
Expand All @@ -221,10 +221,7 @@ async function getChangelogFromGitHub(baseSha, newSha) {
}
const data = await response.json()

const { base_commit, commits } = data
if (currentPage === 0) {
commits.unshift(base_commit)
}
const { commits } = data
for (const { commit, sha } of commits) {
const title = commit.message.split('\n')[0] || ''
const match =
Expand Down

0 comments on commit 1a18b1a

Please sign in to comment.