Skip to content

Commit

Permalink
fix: AWS CodeCommit compatibility (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
giacris82 authored Dec 16, 2024
1 parent 8af4513 commit 687e2e2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function generateNotes(pluginConfig, context) {
);
port = protocol.includes("ssh") ? "" : port;
protocol = protocol && /http[^s]/.test(protocol) ? "http" : "https";
const [, owner, repository] = /^\/(?<owner>[^/]+)?\/?(?<repository>.+)?$/.exec(pathname);
const [, owner, repository] = /^\/(?<owner>[^/]+)?\/?(?<repository>.+)?$/.exec(pathname) || [];

const { issue, commit, referenceActions, issuePrefixes } =
find(HOSTS_CONFIG, (conf) => conf.hostname === hostname) || HOSTS_CONFIG.default;
Expand Down
25 changes: 25 additions & 0 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,3 +686,28 @@ test.serial('ReThrow error from "conventional-changelog"', async (t) => {
{ message: "Test error" }
);
});

test("Accept a custom AWS CodeCommit repository URL", async (t) => {
const { generateNotes } = await import("../index.js");
const commits = [
{ hash: "111", message: "fix(scope1): First fix" },
{ hash: "222", message: "feat(scope2): Second feature" },
];
const changelog = await generateNotes(
{},
{
cwd,
options: {
repositoryUrl: "codecommit::eu-central-1://profile@repository-name",
},
lastRelease,
nextRelease,
commits,
}
);

t.regex(changelog, /### Bug Fixes/);
t.regex(changelog, new RegExp(escape("* **scope1:** First fix 111")));
t.regex(changelog, /### Features/);
t.regex(changelog, new RegExp(escape("* **scope2:** Second feature 222")));
});

0 comments on commit 687e2e2

Please sign in to comment.