Unverified Commit f7c5480b authored by Sebastian Silbermann's avatar Sebastian Silbermann Committed by GitHub

React sync: Handle React PRs landed via ghstack (#66069)

parent 0329a8f7
...@@ -222,16 +222,19 @@ async function getChangelogFromGitHub(baseSha, newSha) { ...@@ -222,16 +222,19 @@ async function getChangelogFromGitHub(baseSha, newSha) {
} }
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] || ''
// The "title" looks like "[Fiber][Float] preinitialized stylesheets should support integrity option (#26881)" const match =
const match = /\(#([0-9]+)\)$/.exec(title) // The "title" looks like "[Fiber][Float] preinitialized stylesheets should support integrity option (#26881)"
/\(#([0-9]+)\)$/.exec(title) ??
// or contains "Pull Request resolved: https://github.com/facebook/react/pull/12345" in the body if merged via ghstack (e.g. https://github.com/facebook/react/commit/0a0a5c02f138b37e93d5d93341b494d0f5d52373)
/^Pull Request resolved: https:\/\/github.com\/facebook\/react\/pull\/([0-9]+)$/m.exec(
commit.message
)
const prNum = match ? match[1] : '' const prNum = match ? match[1] : ''
if (prNum) { if (prNum) {
changelog.push(`- https://github.com/facebook/react/pull/${prNum}`) changelog.push(`- https://github.com/facebook/react/pull/${prNum}`)
} else { } else {
changelog.push( changelog.push(
`- ${sha.slice(0, 9)} ${commit.message.split('\n')[0]} (${ `- [${commit.message.split('\n')[0]} facebook/react@${sha.slice(0, 9)}](https://github.com/facebook/react/commit/${sha}) (${commit.author.name})`
commit.author.name
})`
) )
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment