Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion lib/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ export default async function verify(pluginConfig, context, { Octokit }) {
} = await octokit.request("GET /repos/{owner}/{repo}", { repo, owner });
// Verify if Repository Name wasn't changed
const parsedCloneUrl = parseGithubUrl(clone_url);
if (owner !== parsedCloneUrl.owner || repo !== parsedCloneUrl.repo) {
if (
`${owner}/${repo}`.toLowerCase() !==
`${parsedCloneUrl.owner}/${parsedCloneUrl.repo}`.toLowerCase()
) {
errors.push(
getError("EMISMATCHGITHUBURL", { repositoryUrl, clone_url }),
);
Expand Down
34 changes: 34 additions & 0 deletions test/verify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,40 @@ test("Throw SemanticReleaseError if the repository doesn't exist", async (t) =>
t.true(fetch.done());
});

test(`Don't throw an error if owner/repo only differs in case`, async (t) => {
const env = { GH_TOKEN: "github_token" };

const fetch = fetchMock.sandbox().getOnce(
`https://api.github.local/repos/org/foo`,
{
permissions: { push: true },
clone_url: `https://github.com/ORG/FOO.git`,
},
{ repeat: 2 },
);

await t.notThrowsAsync(
verify(
{},
{
env,
options: {
repositoryUrl: `https://github.com/org/foo.git`,
},
logger: t.context.logger,
},
{
Octokit: TestOctokit.defaults((options) => ({
...options,
request: { ...options.request, fetch },
})),
},
),
);

t.true(fetch.done());
});

const urlFormats = [
(owner, repo) => `https://github.com/${owner}/${repo}.git`,
(owner, repo) => `git+https://github.com/${owner}/${repo}.git`,
Expand Down