Skip to content

Commit a0d1846

Browse files
authored
feat: support PR-URL with trailing slash (#70)
* feat: support PR-URL with trailing slash * fixup! feat: support PR-URL with trailing slash
1 parent 6ce03a0 commit a0d1846

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

branch-diff.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,19 @@ async function findMergeBase (repoPath, branch1, branch2) {
5353
return data.substr(0, 10)
5454
}
5555

56+
function normalizeIfTrailingSlash (commit) {
57+
if (commit.prUrl.at(-1) === '/') {
58+
commit.prUrl = commit.prUrl.slice(0, -1)
59+
}
60+
}
61+
5662
async function diffCollected (options, branchCommits) {
5763
function isInList (commit) {
64+
normalizeIfTrailingSlash(commit)
5865
return branchCommits[0].some((c) => {
5966
if (commit.sha === c.sha) { return true }
6067
if (commit.summary === c.summary) {
68+
normalizeIfTrailingSlash(c)
6169
if (commit.prUrl && c.prUrl) {
6270
return commit.prUrl === c.prUrl
6371
} else if (commit.author.name === c.author.name &&

0 commit comments

Comments
 (0)