Skip to content

Commit b6d9762

Browse files
committed
fix: ignore case when checking for repo rename
fix #901
1 parent 24ea2ee commit b6d9762

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

lib/verify.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ export default async function verify(pluginConfig, context, { Octokit }) {
109109
} = await octokit.request("GET /repos/{owner}/{repo}", { repo, owner });
110110
// Verify if Repository Name wasn't changed
111111
const parsedCloneUrl = parseGithubUrl(clone_url);
112-
if (owner !== parsedCloneUrl.owner || repo !== parsedCloneUrl.repo) {
112+
if (
113+
`${owner}/${repo}`.toLowerCase() !==
114+
`${parsedCloneUrl.owner}/${parsedCloneUrl.repo}`.toLowerCase()
115+
) {
113116
errors.push(
114117
getError("EMISMATCHGITHUBURL", { repositoryUrl, clone_url }),
115118
);

temp.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
┌──────────┬───────────────────────────────┬────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
2+
│ id │ created │ component │ fields │
3+
├──────────┼───────────────────────────────┼────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
4+
│ 10436876 │ 2024-08-16 19:52:44.439203+00 │ MQTTConnection │ {"action": "close", "taskId": "929332abd1564210a6b7e77298fa069a", "instanceId": "i-0a4ff25571730e9b9", "connectionUuid": "1ab40080-5c09-11ef-a506-a1f067a49dac", "application_name": "kes-clarity-mqtt"} │
5+
│ 10436875 │ 2024-08-16 19:52:43.729906+00 │ MQTTConnection │ {"action": "close", "taskId": "04e211a2b724485ca00df984aefebd14", "instanceId": "i-038e9cf8b74e41ed5", "connectionUuid": "1a4957d0-5c09-11ef-bdc8-916ea1de0e5a", "application_name": "kes-clarity-mqtt"} │
6+
│ 10436874 │ 2024-08-16 19:52:43.580017+00 │ MQTTConnection │ {"action": "close", "taskId": "04e211a2b724485ca00df984aefebd14", "instanceId": "i-038e9cf8b74e41ed5", "connectionUuid": "1a327470-5c09-11ef-bdc8-916ea1de0e5a", "application_name": "kes-clarity-mqtt"} │
7+
│ 10436873 │ 2024-08-16 19:52:43.454882+00 │ MQTTConnection │ {"action": "close", "taskId": "04e211a2b724485ca00df984aefebd14", "instanceId": "i-038e9cf8b74e41ed5", "connectionUuid": "1a1f61a0-5c09-11ef-bdc8-916ea1de0e5a", "application_name": "kes-clarity-mqtt"} │
8+
│ 10436872 │ 2024-08-16 19:52:43.401258+00 │ MQTTConnection │ {"action": "close", "taskId": "929332abd1564210a6b7e77298fa069a", "instanceId": "i-0a4ff25571730e9b9", "connectionUuid": "1a174b50-5c09-11ef-a506-a1f067a49dac", "application_name": "kes-clarity-mqtt"} │
9+
│ 10436871 │ 2024-08-16 19:52:43.142396+00 │ MQTTConnection │ {"action": "close", "taskId": "929332abd1564210a6b7e77298fa069a", "instanceId": "i-0a4ff25571730e9b9", "connectionUuid": "19efc620-5c09-11ef-a506-a1f067a49dac", "application_name": "kes-clarity-mqtt"} │
10+
│ 10436870 │ 2024-08-16 19:52:42.032209+00 │ MQTTConnection │ {"action": "close", "taskId": "04e211a2b724485ca00df984aefebd14", "instanceId": "i-038e9cf8b74e41ed5", "connectionUuid": "19463fb0-5c09-11ef-bdc8-916ea1de0e5a", "application_name": "kes-clarity-mqtt"} │
11+
│ 10436869 │ 2024-08-16 19:52:41.850132+00 │ MQTTConnection │ {"action": "close", "taskId": "929332abd1564210a6b7e77298fa069a", "instanceId": "i-0a4ff25571730e9b9", "connectionUuid": "18f44f20-5c09-11ef-a506-a1f067a49dac", "application_name": "kes-clarity-mqtt"} │
12+
│ 10436868 │ 2024-08-16 19:52:41.847475+00 │ MQTTConnection │ {"error": "mqtt protocol error LOGIN_INCORRECT: username or password did not match", "taskId": "929332abd1564210a6b7e77298fa069a", "instanceId": "i-0a4ff25571730e9b9", "connectionUuid": "18f44f20-5c09-11ef-a506-a1f067a49dac", "application_name": "kes-clarity-mqtt"} │
13+
│ 10436867 │ 2024-08-16 19:52:41.639056+00 │ MQTTConnection │ {"action": "connect", "taskId": "929332abd1564210a6b7e77298fa069a", "instanceId": "i-0a4ff25571730e9b9", "connectionUuid": "18f44f20-5c09-11ef-a506-a1f067a49dac", "application_name": "kes-clarity-mqtt"} │
14+
└──────────┴───────────────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
15+
(10 rows)
16+

test/verify.test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,40 @@ test("Throw SemanticReleaseError if the repository doesn't exist", async (t) =>
12691269
t.true(fetch.done());
12701270
});
12711271

1272+
test(`Don't throw an error if owner/repo only differs in case`, async (t) => {
1273+
const env = { GH_TOKEN: "github_token" };
1274+
1275+
const fetch = fetchMock.sandbox().getOnce(
1276+
`https://api.github.local/repos/org/foo`,
1277+
{
1278+
permissions: { push: true },
1279+
clone_url: `https://github.com/ORG/FOO.git`,
1280+
},
1281+
{ repeat: 2 },
1282+
);
1283+
1284+
await t.notThrowsAsync(
1285+
verify(
1286+
{},
1287+
{
1288+
env,
1289+
options: {
1290+
repositoryUrl: `https://github.com/org/foo.git`,
1291+
},
1292+
logger: t.context.logger,
1293+
},
1294+
{
1295+
Octokit: TestOctokit.defaults((options) => ({
1296+
...options,
1297+
request: { ...options.request, fetch },
1298+
})),
1299+
},
1300+
),
1301+
);
1302+
1303+
t.true(fetch.done());
1304+
});
1305+
12721306
const urlFormats = [
12731307
(owner, repo) => `https://github.com/${owner}/${repo}.git`,
12741308
(owner, repo) => `git+https://github.com/${owner}/${repo}.git`,

0 commit comments

Comments
 (0)