Skip to content

Commit 9802cb0

Browse files
fix error in casing
1 parent 5d5cff2 commit 9802cb0

4 files changed

Lines changed: 31 additions & 28 deletions

File tree

.github/scripts/.changeset/release-dispatch.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { execFileSync, spawnSync } from "node:child_process";
22
import {
33
assertVersionedReleasePackage,
44
resolveReleasePackage,
5+
validateRepositoryUrl,
56
} from "./release-packages.mjs";
67
import { maybeSyncBackAfterDispatch } from "./release-sync-back.mjs";
78

@@ -393,6 +394,7 @@ export const dispatchRelease = async ({
393394

394395
logStep(`Checking ${pkg.name} on ${branchName}.`);
395396
assertVersionedReleasePackage(pkg, { repoRoot });
397+
validateRepositoryUrl({ pkg, repo });
396398

397399
const currentBranch = capture("git", ["branch", "--show-current"], {
398400
cwd: repoRoot,

.github/scripts/.changeset/release-packages.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,30 @@ export const resolveReleasePackage = async ({
195195
`${requestedPublicPackage.name} is not a release ${phase} candidate. ${requirement}`,
196196
);
197197
};
198+
199+
// npm provenance verification requires the package.json repository.url to
200+
// resolve to the same GitHub repo that the workflow runs in. npm normalizes
201+
// `git+https://github.com/Owner/Repo.git` → `https://github.com/Owner/Repo`
202+
// for comparison, but the owner/repo casing must match exactly. A mismatch
203+
// causes publish to fail with E422 after the workflow already ran.
204+
const normalizeRepositoryUrl = (url) =>
205+
url.replace(/^git\+/, "").replace(/\.git$/, "");
206+
207+
export const validateRepositoryUrl = ({ pkg, repo }) => {
208+
const expected = `https://github.com/${repo}`;
209+
const raw =
210+
typeof pkg.repository === "string" ? pkg.repository : pkg.repository?.url;
211+
212+
if (!raw) {
213+
throw new Error(
214+
`${pkg.name} has no repository field in package.json. Provenance publishing requires it to be "${expected}".`,
215+
);
216+
}
217+
218+
const normalized = normalizeRepositoryUrl(raw);
219+
if (normalized !== expected) {
220+
throw new Error(
221+
`${pkg.name} repository.url is "${raw}" (normalized: "${normalized}"), but provenance expects "${expected}". Fix the repository.url in package.json before releasing.`,
222+
);
223+
}
224+
};

.github/scripts/.changeset/release-runner.mjs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
assertVersionedReleasePackage,
66
getPendingChangesets,
77
resolveReleasePackage,
8+
validateRepositoryUrl,
89
} from "./release-packages.mjs";
910
import {
1011
bootstrapRelease as runBootstrapRelease,
@@ -108,33 +109,6 @@ const validateSinglePackagePrepare = ({ pkg, repoRoot }) => {
108109
}
109110
};
110111

111-
// npm provenance verification requires the package.json repository.url to
112-
// resolve to the same GitHub repo that the workflow runs in. npm normalizes
113-
// `git+https://github.com/Owner/Repo.git` → `https://github.com/Owner/Repo`
114-
// for comparison, but the owner/repo casing must match exactly. A mismatch
115-
// causes publish to fail with E422 after the workflow already ran.
116-
const normalizeRepositoryUrl = (url) =>
117-
url.replace(/^git\+/, "").replace(/\.git$/, "");
118-
119-
const validateRepositoryUrl = ({ pkg, repo }) => {
120-
const expected = `https://github.com/${repo}`;
121-
const raw =
122-
typeof pkg.repository === "string" ? pkg.repository : pkg.repository?.url;
123-
124-
if (!raw) {
125-
throw new Error(
126-
`${pkg.name} has no repository field in package.json. Provenance publishing requires it to be "${expected}".`,
127-
);
128-
}
129-
130-
const normalized = normalizeRepositoryUrl(raw);
131-
if (normalized !== expected) {
132-
throw new Error(
133-
`${pkg.name} repository.url is "${raw}" (normalized: "${normalized}"), but provenance expects "${expected}". Fix the repository.url in package.json before releasing.`,
134-
);
135-
}
136-
};
137-
138112
const removeUnrelatedChangesets = ({ dryRun, pkg, repoRoot }) => {
139113
const selectedChangesets = new Set(pkg.changesetFiles);
140114
const files = getPendingChangesets(repoRoot).filter(

astro-smooth-actions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"author": "FujoCoded LLC",
1111
"repository": {
1212
"type": "git",
13-
"url": "git+https://github.com/fujowebdev/fujocoded-plugins.git"
13+
"url": "git+https://github.com/FujoWebDev/fujocoded-plugins.git"
1414
},
1515
"files": [
1616
"dist",

0 commit comments

Comments
 (0)