Skip to content

Commit 28f6fec

Browse files
committed
try comparing the branches directly instead
1 parent bf257a9 commit 28f6fec

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/github.ts renamed to src/generate-changelog.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ export async function generateChangelog(
6161
}
6262

6363
if (lastReleaseVersion) {
64-
// Find all the commits between the current release and the last release.
64+
// Find all the commits in the branch for the current release that aren't in the branch for the last release.
65+
const currentBranch = branchFromVersion(currentVersion, channel)
66+
const previousBranch = branchFromVersion(lastReleaseVersion, channel)
67+
6568
const command = shell.exec(
66-
`git --no-pager log ${lastReleaseVersion}...${currentVersion} --pretty=format:%H`,
69+
`git --no-pager log ^${previousBranch} ${currentBranch} --pretty=format:%H`,
6770
{silent: true}
6871
)
6972

@@ -80,6 +83,13 @@ export async function generateChangelog(
8083
}
8184
}
8285

86+
function branchFromVersion(version: string, channel: string): string {
87+
return `origin/${channel}_release/${version.substring(
88+
0,
89+
version.indexOf('_')
90+
)}`
91+
}
92+
8393
// Fetches PR body text from a series of commits.
8494
async function fetchPullRequestBodyFromCommits(
8595
commits: string[],

0 commit comments

Comments
 (0)