@semantic-release/github 10.1.1 → 10.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/definitions/errors.js +11 -0
- package/lib/verify.js +27 -0
- package/package.json +1 -1
|
@@ -139,6 +139,17 @@ By default the \`repositoryUrl\` option is retrieved from the \`repository\` pro
|
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
export function EMISMATCHGITHUBURL() {
|
|
143
|
+
return {
|
|
144
|
+
message: "The git repository URL mismatches the GitHub URL.",
|
|
145
|
+
details: `The **semantic-release** \`repositoryUrl\` option must match your GitHub URL with the format \`<GitHub_or_GHE_URL>/<owner>/<repo>.git\`.
|
|
146
|
+
|
|
147
|
+
By default the \`repositoryUrl\` option is retrieved from the \`repository\` property of your \`package.json\` or the [git origin url](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) of the repository cloned by your CI environment.
|
|
148
|
+
|
|
149
|
+
Note: If you have recently changed your GitHub repository name or owner, update the value in **semantic-release** \`repositoryUrl\` option and the \`repository\` property of your \`package.json\` respectively to match the new GitHub URL.`,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
142
153
|
export function EINVALIDPROXY({ proxy }) {
|
|
143
154
|
return {
|
|
144
155
|
message: "Invalid `proxy` option.",
|
package/lib/verify.js
CHANGED
|
@@ -144,6 +144,33 @@ export default async function verify(pluginConfig, context, { Octokit }) {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
// Verify if Repository Name wasn't changed
|
|
148
|
+
if (
|
|
149
|
+
owner &&
|
|
150
|
+
repo &&
|
|
151
|
+
githubToken &&
|
|
152
|
+
!errors.find(({ code }) => code === "EINVALIDPROXY") &&
|
|
153
|
+
!errors.find(({ code }) => code === "EMISSINGREPO")
|
|
154
|
+
) {
|
|
155
|
+
const octokit = new Octokit(
|
|
156
|
+
toOctokitOptions({
|
|
157
|
+
githubToken,
|
|
158
|
+
githubUrl,
|
|
159
|
+
githubApiPathPrefix,
|
|
160
|
+
githubApiUrl,
|
|
161
|
+
proxy,
|
|
162
|
+
}),
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const {
|
|
166
|
+
status,
|
|
167
|
+
data: { clone_url },
|
|
168
|
+
} = await octokit.request("GET /repos/{owner}/{repo}", { owner, repo });
|
|
169
|
+
if (status !== 200 || repositoryUrl !== clone_url) {
|
|
170
|
+
errors.push(getError("EMISMATCHGITHUBURL"));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
147
174
|
if (!githubToken) {
|
|
148
175
|
errors.push(getError("ENOGHTOKEN", { owner, repo }));
|
|
149
176
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semantic-release/github",
|
|
3
3
|
"description": "semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues",
|
|
4
|
-
"version": "10.1.
|
|
4
|
+
"version": "10.1.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
|
|
7
7
|
"ava": {
|