Skip to content

Commit

Permalink
Add base prs to release script
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Nov 18, 2022
1 parent a8d7180 commit 9a74163
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const [mainPackage, mainLockFile, browserPackage, repo, issues, changelog] = awa
const isMainBranch = currentBranch === MAIN_BRANCH;
const [newVersion, includedPRs] = await Promise.all([
getNewVersion(mainPackage, isMainBranch),
getIncludedPRs(changelog, repo)
getIncludedPRs(changelog, repo, currentBranch, isMainBranch)
]);

let changelogEntry, gitTag;
Expand Down Expand Up @@ -149,7 +149,7 @@ function getFirstChangelogEntry(changelog) {
return { currentVersion, index, previousVersion, text };
}

async function getIncludedPRs(changelog, repo) {
async function getIncludedPRs(changelog, repo, currentBranch, isMainBranch) {
const { currentVersion } = getFirstChangelogEntry(changelog);
const commits = await runAndGetStdout('git', [
'--no-pager',
Expand All @@ -163,6 +163,16 @@ async function getIncludedPRs(changelog, repo) {
while ((match = getPrRegExp.exec(commits))) {
prs.push({ pr: match[2], text: match[1].split('\n')[0] });
}

if (!isMainBranch) {
const { data: basePrs } = await repo.listPullRequests({
head: `rollup:${currentBranch}`,
state: 'open'
});
for (const { number, title } of basePrs) {
prs.push({ pr: number, text: title });
}
}
prs.sort((a, b) => (a.pr > b.pr ? 1 : -1));
return Promise.all(
prs.map(async ({ pr, text }) => {
Expand Down

0 comments on commit 9a74163

Please sign in to comment.