Skip to content

Commit 687e2e2

Browse files
authored
fix: AWS CodeCommit compatibility (#748)
1 parent 8af4513 commit 687e2e2

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function generateNotes(pluginConfig, context) {
3939
);
4040
port = protocol.includes("ssh") ? "" : port;
4141
protocol = protocol && /http[^s]/.test(protocol) ? "http" : "https";
42-
const [, owner, repository] = /^\/(?<owner>[^/]+)?\/?(?<repository>.+)?$/.exec(pathname);
42+
const [, owner, repository] = /^\/(?<owner>[^/]+)?\/?(?<repository>.+)?$/.exec(pathname) || [];
4343

4444
const { issue, commit, referenceActions, issuePrefixes } =
4545
find(HOSTS_CONFIG, (conf) => conf.hostname === hostname) || HOSTS_CONFIG.default;

test/integration.test.js

+25
Original file line numberDiff line numberDiff line change
@@ -686,3 +686,28 @@ test.serial('ReThrow error from "conventional-changelog"', async (t) => {
686686
{ message: "Test error" }
687687
);
688688
});
689+
690+
test("Accept a custom AWS CodeCommit repository URL", async (t) => {
691+
const { generateNotes } = await import("../index.js");
692+
const commits = [
693+
{ hash: "111", message: "fix(scope1): First fix" },
694+
{ hash: "222", message: "feat(scope2): Second feature" },
695+
];
696+
const changelog = await generateNotes(
697+
{},
698+
{
699+
cwd,
700+
options: {
701+
repositoryUrl: "codecommit::eu-central-1://profile@repository-name",
702+
},
703+
lastRelease,
704+
nextRelease,
705+
commits,
706+
}
707+
);
708+
709+
t.regex(changelog, /### Bug Fixes/);
710+
t.regex(changelog, new RegExp(escape("* **scope1:** First fix 111")));
711+
t.regex(changelog, /### Features/);
712+
t.regex(changelog, new RegExp(escape("* **scope2:** Second feature 222")));
713+
});

0 commit comments

Comments
 (0)