Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
99f59438
Unverified
Commit
99f59438
authored
May 21, 2024
by
Sebastian Silbermann
Committed by
GitHub
May 21, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve `sync-react` changelog generator (#66051)
parent
1f545aff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
sync-react.js
scripts/sync-react.js
+16
-6
No files found.
scripts/sync-react.js
View file @
99f59438
...
@@ -144,7 +144,9 @@ Or, run this command with no arguments to use the most recently published versio
...
@@ -144,7 +144,9 @@ Or, run this command with no arguments to use the most recently published versio
`GitHub reported no changes between
${
baseSha
}
and
${
newSha
}
.`
`GitHub reported no changes between
${
baseSha
}
and
${
newSha
}
.`
)
)
}
else
{
}
else
{
console
.
log
(
`### React upstream changes\n\n
${
changelog
}
\n\n`
)
console
.
log
(
`<details>\n<summary>React upstream changes</summary>\n\n
${
changelog
}
\n\n</details>`
)
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
error
)
console
.
error
(
error
)
...
@@ -187,11 +189,19 @@ async function getChangelogFromGitHub(baseSha, newSha) {
...
@@ -187,11 +189,19 @@ async function getChangelogFromGitHub(baseSha, newSha) {
const
pageSize
=
50
const
pageSize
=
50
let
changelog
=
[]
let
changelog
=
[]
for
(
let
currentPage
=
0
;
;
currentPage
++
)
{
for
(
let
currentPage
=
0
;
;
currentPage
++
)
{
const
response
=
await
fetch
(
const
url
=
`https://api.github.com/repos/facebook/react/compare/
${
baseSha
}
...
${
newSha
}
?per_page=
${
pageSize
}
&page=
${
currentPage
}
`
`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.
if
(
process
.
env
.
GITHUB_TOKEN
)
{
headers
.
Authorization
=
`token
${
process
.
env
.
GITHUB_TOKEN
}
`
}
const
response
=
await
fetch
(
url
,
{
headers
,
})
if
(
!
response
.
ok
)
{
if
(
!
response
.
ok
)
{
throw
new
Error
(
'Failed to fetch commit log from GitHub.'
)
throw
new
Error
(
`
${
response
.
url
}
: Failed to fetch commit log from GitHub:\n
${
response
.
statusText
}
\n
${
await
response
.
text
()}
`
)
}
}
const
data
=
await
response
.
json
()
const
data
=
await
response
.
json
()
...
@@ -215,7 +225,7 @@ async function getChangelogFromGitHub(baseSha, newSha) {
...
@@ -215,7 +225,7 @@ async function getChangelogFromGitHub(baseSha, newSha) {
}
}
}
}
if
(
commits
.
length
!==
pageSize
)
{
if
(
commits
.
length
<
pageSize
)
{
// If the number of commits is less than the page size, we've reached
// If the number of commits is less than the page size, we've reached
// the end. Otherwise we'll keep fetching until we run out.
// the end. Otherwise we'll keep fetching until we run out.
break
break
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment