@semantic-release/github 10.1.3 → 10.1.5
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/README.md +2 -2
- package/lib/definitions/errors.js +13 -0
- package/lib/get-fail-comment.js +2 -2
- package/lib/verify.js +17 -18
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -95,8 +95,8 @@ When using the _GITHUB_TOKEN_, the **minimum required permissions** are:
|
|
|
95
95
|
| `releasedLabels` | The [labels](https://help.github.com/articles/about-labels) to add to each issue and pull request resolved by the release. Set to `false` to not add any label. See [releasedLabels](#releasedlabels). | `['released<%= nextRelease.channel ? \` on @\${nextRelease.channel}\` : "" %>']- |
|
|
96
96
|
| `addReleases` | Will add release links to the GitHub Release. Can be `false`, `"bottom"` or `"top"`. See [addReleases](#addReleases). | `false` |
|
|
97
97
|
| `draftRelease` | A boolean indicating if a GitHub Draft Release should be created instead of publishing an actual GitHub Release. | `false` |
|
|
98
|
-
| `releaseNameTemplate` | A [Lodash template](https://lodash.com/docs#template) to customize the github release's name | `<%=
|
|
99
|
-
| `releaseBodyTemplate` | A [Lodash template](https://lodash.com/docs#template) to customize the github release's body | `<%=
|
|
98
|
+
| `releaseNameTemplate` | A [Lodash template](https://lodash.com/docs#template) to customize the github release's name | `<%= nextRelease.name %>` |
|
|
99
|
+
| `releaseBodyTemplate` | A [Lodash template](https://lodash.com/docs#template) to customize the github release's body | `<%= nextRelease.notes %>` |
|
|
100
100
|
| `discussionCategoryName` | The category name in which to create a linked discussion to the release. Set to `false` to disable creating discussion for a release. | `false` |
|
|
101
101
|
|
|
102
102
|
#### proxy
|
|
@@ -139,6 +139,19 @@ By default the \`repositoryUrl\` option is retrieved from the \`repository\` pro
|
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
export function EMISMATCHGITHUBURL({ repositoryUrl, clone_url }) {
|
|
143
|
+
return {
|
|
144
|
+
message: "The git repository URL mismatches the GitHub URL.",
|
|
145
|
+
details: `The **semantic-release** \`repositoryUrl\` option must have the same repository name and owner as the GitHub repo.
|
|
146
|
+
|
|
147
|
+
Your configuration for the \`repositoryUrl\` option is \`${stringify(repositoryUrl)}\` and the \`clone_url\` of your GitHub repo is \`${stringify(clone_url)}\`.
|
|
148
|
+
|
|
149
|
+
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.
|
|
150
|
+
|
|
151
|
+
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.`,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
142
155
|
export function EINVALIDPROXY({ proxy }) {
|
|
143
156
|
return {
|
|
144
157
|
message: "Invalid `proxy` option.",
|
package/lib/get-fail-comment.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const HOME_URL = "https://github.com/semantic-release/semantic-release";
|
|
2
|
-
const FAQ_URL = `${HOME_URL}/blob/
|
|
2
|
+
const FAQ_URL = `${HOME_URL}/blob/master/docs/support/FAQ.md`;
|
|
3
3
|
const GET_HELP_URL = `${HOME_URL}#get-help`;
|
|
4
|
-
const USAGE_DOC_URL = `${HOME_URL}/blob/
|
|
4
|
+
const USAGE_DOC_URL = `${HOME_URL}/blob/master/docs/usage/README.md`;
|
|
5
5
|
const NEW_ISSUE_URL = `${HOME_URL}/issues/new`;
|
|
6
6
|
|
|
7
7
|
const formatError = (error) => `### ${error.message}
|
package/lib/verify.js
CHANGED
|
@@ -103,35 +103,34 @@ export default async function verify(pluginConfig, context, { Octokit }) {
|
|
|
103
103
|
proxy,
|
|
104
104
|
}),
|
|
105
105
|
);
|
|
106
|
-
|
|
107
|
-
// https://github.com/semantic-release/github/issues/182
|
|
108
|
-
// Do not check for permissions in GitHub actions, as the provided token is an installation access token.
|
|
109
|
-
// octokit.request("GET /repos/{owner}/{repo}", {repo, owner}) does not return the "permissions" key in that case.
|
|
110
|
-
// But GitHub Actions have all permissions required for @semantic-release/github to work
|
|
111
|
-
if (env.GITHUB_ACTION) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
106
|
try {
|
|
116
107
|
const {
|
|
117
|
-
data: {
|
|
118
|
-
permissions: { push },
|
|
119
|
-
},
|
|
108
|
+
data: { permissions, clone_url },
|
|
120
109
|
} = await octokit.request("GET /repos/{owner}/{repo}", { repo, owner });
|
|
121
|
-
if
|
|
110
|
+
// Verify if Repository Name wasn't changed
|
|
111
|
+
const parsedCloneUrl = parseGithubUrl(clone_url);
|
|
112
|
+
if (owner !== parsedCloneUrl.owner || repo !== parsedCloneUrl.repo) {
|
|
113
|
+
errors.push(
|
|
114
|
+
getError("EMISMATCHGITHUBURL", { repositoryUrl, clone_url }),
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// https://github.com/semantic-release/github/issues/182
|
|
119
|
+
// Do not check for permissions in GitHub actions, as the provided token is an installation access token.
|
|
120
|
+
// octokit.request("GET /repos/{owner}/{repo}", {repo, owner}) does not return the "permissions" key in that case.
|
|
121
|
+
// But GitHub Actions have all permissions required for @semantic-release/github to work
|
|
122
|
+
if (!env.GITHUB_ACTION && !permissions?.push) {
|
|
122
123
|
// If authenticated as GitHub App installation, `push` will always be false.
|
|
123
124
|
// We send another request to check if current authentication is an installation.
|
|
124
125
|
// Note: we cannot check if the installation has all required permissions, it's
|
|
125
126
|
// up to the user to make sure it has
|
|
126
127
|
if (
|
|
127
|
-
await octokit
|
|
128
|
+
!(await octokit
|
|
128
129
|
.request("HEAD /installation/repositories", { per_page: 1 })
|
|
129
|
-
.catch(() => false)
|
|
130
|
+
.catch(() => false))
|
|
130
131
|
) {
|
|
131
|
-
|
|
132
|
+
errors.push(getError("EGHNOPERMISSION", { owner, repo }));
|
|
132
133
|
}
|
|
133
|
-
|
|
134
|
-
errors.push(getError("EGHNOPERMISSION", { owner, repo }));
|
|
135
134
|
}
|
|
136
135
|
} catch (error) {
|
|
137
136
|
if (error.status === 401) {
|
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.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
|
|
7
7
|
"ava": {
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"ava": "6.1.3",
|
|
44
44
|
"c8": "10.1.2",
|
|
45
|
-
"cpy": "11.0
|
|
45
|
+
"cpy": "11.1.0",
|
|
46
46
|
"cz-conventional-changelog": "3.3.0",
|
|
47
47
|
"fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
|
|
48
48
|
"lockfile-lint": "4.14.0",
|
|
49
|
-
"ls-engines": "0.9.
|
|
49
|
+
"ls-engines": "0.9.3",
|
|
50
50
|
"npm-run-all2": "6.2.2",
|
|
51
51
|
"prettier": "3.3.3",
|
|
52
52
|
"publint": "0.2.9",
|