Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: AWS CodeCommit compatibility #748

Merged
merged 5 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
24 changes: 24 additions & 0 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,3 +686,27 @@ test.serial('ReThrow error from "conventional-changelog"', async (t) => {
{ message: "Test error" }
);
});

test('Accept a custom AWS CodeCommit repository URL', async t => {
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')));
});
Loading