@semantic-release/github 8.1.0 → 9.0.0-beta.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/README.md +29 -27
- package/index.js +62 -28
- package/lib/add-channel.js +57 -28
- package/lib/definitions/constants.js +2 -4
- package/lib/definitions/errors.js +154 -78
- package/lib/definitions/retry.js +1 -3
- package/lib/definitions/throttle.js +1 -3
- package/lib/fail.js +49 -30
- package/lib/find-sr-issues.js +4 -4
- package/lib/get-error.js +6 -5
- package/lib/get-fail-comment.js +10 -8
- package/lib/get-release-links.js +10 -7
- package/lib/get-search-queries.js +6 -3
- package/lib/get-success-comment.js +15 -8
- package/lib/glob-assets.js +63 -52
- package/lib/is-prerelease.js +3 -1
- package/lib/octokit.js +76 -0
- package/lib/parse-github-url.js +15 -7
- package/lib/publish.js +88 -58
- package/lib/resolve-config.js +33 -22
- package/lib/success.js +154 -89
- package/lib/verify.js +66 -33
- package/package.json +26 -46
- package/lib/get-client.js +0 -24
- package/lib/semantic-release-octokit.js +0 -35
package/lib/success.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { isNil, uniqBy, template, flatten, isEmpty } from "lodash-es";
|
|
2
|
+
import pFilter from "p-filter";
|
|
3
|
+
import AggregateError from "aggregate-error";
|
|
4
|
+
import issueParser from "issue-parser";
|
|
5
|
+
import debugFactory from "debug";
|
|
6
|
+
|
|
7
|
+
import parseGithubUrl from "./parse-github-url.js";
|
|
8
|
+
import resolveConfig from "./resolve-config.js";
|
|
9
|
+
import { toOctokitOptions } from "./octokit.js";
|
|
10
|
+
import getSearchQueries from "./get-search-queries.js";
|
|
11
|
+
import getSuccessComment from "./get-success-comment.js";
|
|
12
|
+
import findSRIssues from "./find-sr-issues.js";
|
|
13
|
+
import { RELEASE_NAME } from "./definitions/constants.js";
|
|
14
|
+
import getReleaseLinks from "./get-release-links.js";
|
|
15
|
+
|
|
16
|
+
const debug = debugFactory("semantic-release:github");
|
|
17
|
+
|
|
18
|
+
export default async function success(pluginConfig, context, { Octokit }) {
|
|
16
19
|
const {
|
|
17
|
-
options: {repositoryUrl},
|
|
20
|
+
options: { repositoryUrl },
|
|
18
21
|
commits,
|
|
19
22
|
nextRelease,
|
|
20
23
|
releases,
|
|
@@ -32,95 +35,144 @@ module.exports = async (pluginConfig, context) => {
|
|
|
32
35
|
addReleases,
|
|
33
36
|
} = resolveConfig(pluginConfig, context);
|
|
34
37
|
|
|
35
|
-
const octokit =
|
|
38
|
+
const octokit = new Octokit(
|
|
39
|
+
toOctokitOptions({ githubToken, githubUrl, githubApiPathPrefix, proxy })
|
|
40
|
+
);
|
|
41
|
+
|
|
36
42
|
// In case the repo changed name, get the new `repo`/`owner` as the search API will not follow redirects
|
|
37
|
-
const {data: repoData} = await octokit.request(
|
|
38
|
-
|
|
43
|
+
const { data: repoData } = await octokit.request(
|
|
44
|
+
"GET /repos/{owner}/{repo}",
|
|
45
|
+
parseGithubUrl(repositoryUrl)
|
|
46
|
+
);
|
|
47
|
+
const [owner, repo] = repoData.full_name.split("/");
|
|
39
48
|
|
|
40
49
|
const errors = [];
|
|
41
50
|
|
|
42
51
|
if (successComment === false) {
|
|
43
|
-
logger.log(
|
|
52
|
+
logger.log("Skip commenting on issues and pull requests.");
|
|
44
53
|
} else {
|
|
45
|
-
const parser = issueParser(
|
|
54
|
+
const parser = issueParser(
|
|
55
|
+
"github",
|
|
56
|
+
githubUrl ? { hosts: [githubUrl] } : {}
|
|
57
|
+
);
|
|
46
58
|
const releaseInfos = releases.filter((release) => Boolean(release.name));
|
|
47
|
-
const shas = commits.map(({hash}) => hash);
|
|
48
|
-
|
|
49
|
-
const searchQueries = getSearchQueries(
|
|
50
|
-
|
|
59
|
+
const shas = commits.map(({ hash }) => hash);
|
|
60
|
+
|
|
61
|
+
const searchQueries = getSearchQueries(
|
|
62
|
+
`repo:${owner}/${repo}+type:pr+is:merged`,
|
|
63
|
+
shas
|
|
64
|
+
).map(
|
|
65
|
+
async (q) =>
|
|
66
|
+
(await octokit.request("GET /search/issues", { q })).data.items
|
|
51
67
|
);
|
|
52
68
|
|
|
53
69
|
const searchQueriesResults = await Promise.all(searchQueries);
|
|
54
|
-
const uniqueSearchQueriesResults = uniqBy(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
const uniqueSearchQueriesResults = uniqBy(
|
|
71
|
+
flatten(searchQueriesResults),
|
|
72
|
+
"number"
|
|
73
|
+
);
|
|
74
|
+
const prs = await pFilter(
|
|
75
|
+
uniqueSearchQueriesResults,
|
|
76
|
+
async ({ number }) => {
|
|
77
|
+
const commits = await octokit.paginate(
|
|
78
|
+
"GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
|
|
79
|
+
{
|
|
80
|
+
owner,
|
|
81
|
+
repo,
|
|
82
|
+
pull_number: number,
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
const matchingCommit = commits.find(({ sha }) => shas.includes(sha));
|
|
86
|
+
if (matchingCommit) return matchingCommit;
|
|
87
|
+
|
|
88
|
+
const { data: pullRequest } = await octokit.request(
|
|
89
|
+
"GET /repos/{owner}/{repo}/pulls/{pull_number}",
|
|
90
|
+
{
|
|
91
|
+
owner,
|
|
92
|
+
repo,
|
|
93
|
+
pull_number: number,
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
return shas.includes(pullRequest.merge_commit_sha);
|
|
97
|
+
}
|
|
98
|
+
);
|
|
71
99
|
|
|
72
100
|
debug(
|
|
73
|
-
|
|
101
|
+
"found pull requests: %O",
|
|
74
102
|
prs.map((pr) => pr.number)
|
|
75
103
|
);
|
|
76
104
|
|
|
77
105
|
// Parse the release commits message and PRs body to find resolved issues/PRs via comment keyworkds
|
|
78
|
-
const issues = [
|
|
79
|
-
(
|
|
80
|
-
|
|
106
|
+
const issues = [
|
|
107
|
+
...prs.map((pr) => pr.body),
|
|
108
|
+
...commits.map((commit) => commit.message),
|
|
109
|
+
].reduce(
|
|
110
|
+
(issues, message) =>
|
|
111
|
+
message
|
|
81
112
|
? issues.concat(
|
|
82
113
|
parser(message)
|
|
83
|
-
.actions.close.filter(
|
|
84
|
-
|
|
114
|
+
.actions.close.filter(
|
|
115
|
+
(action) =>
|
|
116
|
+
isNil(action.slug) || action.slug === `${owner}/${repo}`
|
|
117
|
+
)
|
|
118
|
+
.map((action) => ({
|
|
119
|
+
number: Number.parseInt(action.issue, 10),
|
|
120
|
+
}))
|
|
85
121
|
)
|
|
86
|
-
: issues
|
|
87
|
-
},
|
|
122
|
+
: issues,
|
|
88
123
|
[]
|
|
89
124
|
);
|
|
90
125
|
|
|
91
|
-
debug(
|
|
126
|
+
debug("found issues via comments: %O", issues);
|
|
92
127
|
|
|
93
128
|
await Promise.all(
|
|
94
|
-
uniqBy([...prs, ...issues],
|
|
129
|
+
uniqBy([...prs, ...issues], "number").map(async (issue) => {
|
|
95
130
|
const body = successComment
|
|
96
|
-
? template(successComment)({...context, issue})
|
|
131
|
+
? template(successComment)({ ...context, issue })
|
|
97
132
|
: getSuccessComment(issue, releaseInfos, nextRelease);
|
|
98
133
|
try {
|
|
99
|
-
const comment = {owner, repo, issue_number: issue.number, body};
|
|
100
|
-
debug(
|
|
134
|
+
const comment = { owner, repo, issue_number: issue.number, body };
|
|
135
|
+
debug("create comment: %O", comment);
|
|
101
136
|
const {
|
|
102
|
-
data: {html_url: url},
|
|
103
|
-
} = await octokit.request(
|
|
104
|
-
|
|
137
|
+
data: { html_url: url },
|
|
138
|
+
} = await octokit.request(
|
|
139
|
+
"POST /repos/{owner}/{repo}/issues/{issue_number}/comments",
|
|
140
|
+
comment
|
|
141
|
+
);
|
|
142
|
+
logger.log("Added comment to issue #%d: %s", issue.number, url);
|
|
105
143
|
|
|
106
144
|
if (releasedLabels) {
|
|
107
|
-
const labels = releasedLabels.map((label) =>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
issue_number
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
145
|
+
const labels = releasedLabels.map((label) =>
|
|
146
|
+
template(label)(context)
|
|
147
|
+
);
|
|
148
|
+
await octokit.request(
|
|
149
|
+
"POST /repos/{owner}/{repo}/issues/{issue_number}/labels",
|
|
150
|
+
{
|
|
151
|
+
owner,
|
|
152
|
+
repo,
|
|
153
|
+
issue_number: issue.number,
|
|
154
|
+
data: labels,
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
logger.log("Added labels %O to issue #%d", labels, issue.number);
|
|
115
158
|
}
|
|
116
159
|
} catch (error) {
|
|
117
160
|
if (error.status === 403) {
|
|
118
|
-
logger.error(
|
|
161
|
+
logger.error(
|
|
162
|
+
"Not allowed to add a comment to the issue #%d.",
|
|
163
|
+
issue.number
|
|
164
|
+
);
|
|
119
165
|
} else if (error.status === 404) {
|
|
120
|
-
logger.error(
|
|
166
|
+
logger.error(
|
|
167
|
+
"Failed to add a comment to the issue #%d as it doesn't exist.",
|
|
168
|
+
issue.number
|
|
169
|
+
);
|
|
121
170
|
} else {
|
|
122
171
|
errors.push(error);
|
|
123
|
-
logger.error(
|
|
172
|
+
logger.error(
|
|
173
|
+
"Failed to add a comment to the issue #%d.",
|
|
174
|
+
issue.number
|
|
175
|
+
);
|
|
124
176
|
// Don't throw right away and continue to update other issues
|
|
125
177
|
}
|
|
126
178
|
}
|
|
@@ -129,25 +181,33 @@ module.exports = async (pluginConfig, context) => {
|
|
|
129
181
|
}
|
|
130
182
|
|
|
131
183
|
if (failComment === false || failTitle === false) {
|
|
132
|
-
logger.log(
|
|
184
|
+
logger.log("Skip closing issue.");
|
|
133
185
|
} else {
|
|
134
186
|
const srIssues = await findSRIssues(octokit, failTitle, owner, repo);
|
|
135
187
|
|
|
136
|
-
debug(
|
|
188
|
+
debug("found semantic-release issues: %O", srIssues);
|
|
137
189
|
|
|
138
190
|
await Promise.all(
|
|
139
191
|
srIssues.map(async (issue) => {
|
|
140
|
-
debug(
|
|
192
|
+
debug("close issue: %O", issue);
|
|
141
193
|
try {
|
|
142
|
-
const updateIssue = {
|
|
143
|
-
|
|
194
|
+
const updateIssue = {
|
|
195
|
+
owner,
|
|
196
|
+
repo,
|
|
197
|
+
issue_number: issue.number,
|
|
198
|
+
state: "closed",
|
|
199
|
+
};
|
|
200
|
+
debug("closing issue: %O", updateIssue);
|
|
144
201
|
const {
|
|
145
|
-
data: {html_url: url},
|
|
146
|
-
} = await octokit.request(
|
|
147
|
-
|
|
202
|
+
data: { html_url: url },
|
|
203
|
+
} = await octokit.request(
|
|
204
|
+
"PATCH /repos/{owner}/{repo}/issues/{issue_number}",
|
|
205
|
+
updateIssue
|
|
206
|
+
);
|
|
207
|
+
logger.log("Closed issue #%d: %s.", issue.number, url);
|
|
148
208
|
} catch (error) {
|
|
149
209
|
errors.push(error);
|
|
150
|
-
logger.error(
|
|
210
|
+
logger.error("Failed to close the issue #%d.", issue.number);
|
|
151
211
|
// Don't throw right away and continue to close other issues
|
|
152
212
|
}
|
|
153
213
|
})
|
|
@@ -155,21 +215,26 @@ module.exports = async (pluginConfig, context) => {
|
|
|
155
215
|
}
|
|
156
216
|
|
|
157
217
|
if (addReleases !== false && errors.length === 0) {
|
|
158
|
-
const ghRelease = releases.find(
|
|
218
|
+
const ghRelease = releases.find(
|
|
219
|
+
(release) => release.name && release.name === RELEASE_NAME
|
|
220
|
+
);
|
|
159
221
|
if (!isNil(ghRelease)) {
|
|
160
222
|
const ghRelaseId = ghRelease.id;
|
|
161
223
|
const additionalReleases = getReleaseLinks(releases);
|
|
162
224
|
if (!isEmpty(additionalReleases) && !isNil(ghRelaseId)) {
|
|
163
225
|
const newBody =
|
|
164
|
-
addReleases ===
|
|
165
|
-
? additionalReleases.concat(
|
|
166
|
-
: nextRelease.notes.concat(
|
|
167
|
-
await octokit.request(
|
|
168
|
-
owner,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
226
|
+
addReleases === "top"
|
|
227
|
+
? additionalReleases.concat("\n---\n", nextRelease.notes)
|
|
228
|
+
: nextRelease.notes.concat("\n---\n", additionalReleases);
|
|
229
|
+
await octokit.request(
|
|
230
|
+
"PATCH /repos/{owner}/{repo}/releases/{release_id}",
|
|
231
|
+
{
|
|
232
|
+
owner,
|
|
233
|
+
repo,
|
|
234
|
+
release_id: ghRelaseId,
|
|
235
|
+
body: newBody,
|
|
236
|
+
}
|
|
237
|
+
);
|
|
173
238
|
}
|
|
174
239
|
}
|
|
175
240
|
}
|
|
@@ -177,4 +242,4 @@ module.exports = async (pluginConfig, context) => {
|
|
|
177
242
|
if (errors.length > 0) {
|
|
178
243
|
throw new AggregateError(errors);
|
|
179
244
|
}
|
|
180
|
-
}
|
|
245
|
+
}
|
package/lib/verify.js
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import {
|
|
2
|
+
isString,
|
|
3
|
+
isPlainObject,
|
|
4
|
+
isNil,
|
|
5
|
+
isArray,
|
|
6
|
+
isNumber,
|
|
7
|
+
isBoolean,
|
|
8
|
+
} from "lodash-es";
|
|
9
|
+
import urlJoin from "url-join";
|
|
10
|
+
import AggregateError from "aggregate-error";
|
|
11
|
+
|
|
12
|
+
import parseGithubUrl from "./parse-github-url.js";
|
|
13
|
+
import resolveConfig from "./resolve-config.js";
|
|
14
|
+
import { toOctokitOptions } from "./octokit.js";
|
|
15
|
+
import getError from "./get-error.js";
|
|
8
16
|
|
|
9
17
|
const isNonEmptyString = (value) => isString(value) && value.trim();
|
|
10
|
-
const oneOf = (enumArray) => (value) => enumArray.
|
|
18
|
+
const oneOf = (enumArray) => (value) => enumArray.includes(value);
|
|
11
19
|
const isStringOrStringArray = (value) =>
|
|
12
|
-
isNonEmptyString(value) ||
|
|
13
|
-
|
|
14
|
-
const
|
|
20
|
+
isNonEmptyString(value) ||
|
|
21
|
+
(isArray(value) && value.every((string) => isNonEmptyString(string)));
|
|
22
|
+
const isArrayOf = (validator) => (array) =>
|
|
23
|
+
isArray(array) && array.every((value) => validator(value));
|
|
24
|
+
const canBeDisabled = (validator) => (value) =>
|
|
25
|
+
value === false || validator(value);
|
|
15
26
|
|
|
16
27
|
const VALIDATORS = {
|
|
17
28
|
proxy: canBeDisabled(
|
|
18
|
-
(proxy) =>
|
|
29
|
+
(proxy) =>
|
|
30
|
+
isNonEmptyString(proxy) ||
|
|
31
|
+
(isPlainObject(proxy) &&
|
|
32
|
+
isNonEmptyString(proxy.host) &&
|
|
33
|
+
isNumber(proxy.port))
|
|
19
34
|
),
|
|
20
35
|
assets: isArrayOf(
|
|
21
|
-
(asset) =>
|
|
36
|
+
(asset) =>
|
|
37
|
+
isStringOrStringArray(asset) ||
|
|
38
|
+
(isPlainObject(asset) && isStringOrStringArray(asset.path))
|
|
22
39
|
),
|
|
23
40
|
successComment: canBeDisabled(isNonEmptyString),
|
|
24
41
|
failTitle: canBeDisabled(isNonEmptyString),
|
|
@@ -26,37 +43,49 @@ const VALIDATORS = {
|
|
|
26
43
|
labels: canBeDisabled(isArrayOf(isNonEmptyString)),
|
|
27
44
|
assignees: isArrayOf(isNonEmptyString),
|
|
28
45
|
releasedLabels: canBeDisabled(isArrayOf(isNonEmptyString)),
|
|
29
|
-
addReleases: canBeDisabled(oneOf([
|
|
46
|
+
addReleases: canBeDisabled(oneOf(["bottom", "top"])),
|
|
30
47
|
draftRelease: isBoolean,
|
|
31
48
|
};
|
|
32
49
|
|
|
33
|
-
|
|
50
|
+
export default async function verify(pluginConfig, context, { Octokit }) {
|
|
34
51
|
const {
|
|
35
52
|
env,
|
|
36
|
-
options: {repositoryUrl},
|
|
53
|
+
options: { repositoryUrl },
|
|
37
54
|
logger,
|
|
38
55
|
} = context;
|
|
39
|
-
const {githubToken, githubUrl, githubApiPathPrefix, proxy, ...options} =
|
|
56
|
+
const { githubToken, githubUrl, githubApiPathPrefix, proxy, ...options } =
|
|
57
|
+
resolveConfig(pluginConfig, context);
|
|
40
58
|
|
|
41
|
-
const errors = Object.entries({...options, proxy}).reduce(
|
|
59
|
+
const errors = Object.entries({ ...options, proxy }).reduce(
|
|
42
60
|
(errors, [option, value]) =>
|
|
43
61
|
!isNil(value) && !VALIDATORS[option](value)
|
|
44
|
-
? [
|
|
62
|
+
? [
|
|
63
|
+
...errors,
|
|
64
|
+
getError(`EINVALID${option.toUpperCase()}`, { [option]: value }),
|
|
65
|
+
]
|
|
45
66
|
: errors,
|
|
46
67
|
[]
|
|
47
68
|
);
|
|
48
69
|
|
|
49
70
|
if (githubUrl) {
|
|
50
|
-
logger.log(
|
|
71
|
+
logger.log(
|
|
72
|
+
"Verify GitHub authentication (%s)",
|
|
73
|
+
urlJoin(githubUrl, githubApiPathPrefix)
|
|
74
|
+
);
|
|
51
75
|
} else {
|
|
52
|
-
logger.log(
|
|
76
|
+
logger.log("Verify GitHub authentication");
|
|
53
77
|
}
|
|
54
78
|
|
|
55
|
-
const {repo, owner} = parseGithubUrl(repositoryUrl);
|
|
79
|
+
const { repo, owner } = parseGithubUrl(repositoryUrl);
|
|
56
80
|
if (!owner || !repo) {
|
|
57
|
-
errors.push(getError(
|
|
58
|
-
} else if (
|
|
59
|
-
|
|
81
|
+
errors.push(getError("EINVALIDGITHUBURL"));
|
|
82
|
+
} else if (
|
|
83
|
+
githubToken &&
|
|
84
|
+
!errors.find(({ code }) => code === "EINVALIDPROXY")
|
|
85
|
+
) {
|
|
86
|
+
const octokit = new Octokit(
|
|
87
|
+
toOctokitOptions({ githubToken, githubUrl, githubApiPathPrefix, proxy })
|
|
88
|
+
);
|
|
60
89
|
|
|
61
90
|
// https://github.com/semantic-release/github/issues/182
|
|
62
91
|
// Do not check for permissions in GitHub actions, as the provided token is an installation access token.
|
|
@@ -69,25 +98,29 @@ module.exports = async (pluginConfig, context) => {
|
|
|
69
98
|
try {
|
|
70
99
|
const {
|
|
71
100
|
data: {
|
|
72
|
-
permissions: {push},
|
|
101
|
+
permissions: { push },
|
|
73
102
|
},
|
|
74
|
-
} = await octokit.request(
|
|
103
|
+
} = await octokit.request("GET /repos/{owner}/{repo}", { repo, owner });
|
|
75
104
|
if (!push) {
|
|
76
105
|
// If authenticated as GitHub App installation, `push` will always be false.
|
|
77
106
|
// We send another request to check if current authentication is an installation.
|
|
78
107
|
// Note: we cannot check if the installation has all required permissions, it's
|
|
79
108
|
// up to the user to make sure it has
|
|
80
|
-
if (
|
|
109
|
+
if (
|
|
110
|
+
await octokit
|
|
111
|
+
.request("HEAD /installation/repositories", { per_page: 1 })
|
|
112
|
+
.catch(() => false)
|
|
113
|
+
) {
|
|
81
114
|
return;
|
|
82
115
|
}
|
|
83
116
|
|
|
84
|
-
errors.push(getError(
|
|
117
|
+
errors.push(getError("EGHNOPERMISSION", { owner, repo }));
|
|
85
118
|
}
|
|
86
119
|
} catch (error) {
|
|
87
120
|
if (error.status === 401) {
|
|
88
|
-
errors.push(getError(
|
|
121
|
+
errors.push(getError("EINVALIDGHTOKEN", { owner, repo }));
|
|
89
122
|
} else if (error.status === 404) {
|
|
90
|
-
errors.push(getError(
|
|
123
|
+
errors.push(getError("EMISSINGREPO", { owner, repo }));
|
|
91
124
|
} else {
|
|
92
125
|
throw error;
|
|
93
126
|
}
|
|
@@ -95,10 +128,10 @@ module.exports = async (pluginConfig, context) => {
|
|
|
95
128
|
}
|
|
96
129
|
|
|
97
130
|
if (!githubToken) {
|
|
98
|
-
errors.push(getError(
|
|
131
|
+
errors.push(getError("ENOGHTOKEN", { owner, repo }));
|
|
99
132
|
}
|
|
100
133
|
|
|
101
134
|
if (errors.length > 0) {
|
|
102
135
|
throw new AggregateError(errors);
|
|
103
136
|
}
|
|
104
|
-
}
|
|
137
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
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": "
|
|
4
|
+
"version": "9.0.0-beta.2",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
|
|
6
7
|
"ava": {
|
|
7
8
|
"files": [
|
|
8
9
|
"test/**/*.test.js"
|
|
10
|
+
],
|
|
11
|
+
"nodeArguments": [
|
|
12
|
+
"--no-warnings"
|
|
9
13
|
]
|
|
10
14
|
},
|
|
11
15
|
"bugs": {
|
|
@@ -19,37 +23,32 @@
|
|
|
19
23
|
"@octokit/core": "^4.2.1",
|
|
20
24
|
"@octokit/plugin-paginate-rest": "^6.1.2",
|
|
21
25
|
"@octokit/plugin-retry": "^4.1.3",
|
|
22
|
-
"@octokit/plugin-throttling": "^
|
|
26
|
+
"@octokit/plugin-throttling": "^6.0.0",
|
|
23
27
|
"@semantic-release/error": "^3.0.0",
|
|
24
|
-
"aggregate-error": "^
|
|
25
|
-
"debug": "^4.
|
|
26
|
-
"dir-glob": "^3.0.
|
|
27
|
-
"
|
|
28
|
-
"globby": "^11.0.0",
|
|
28
|
+
"aggregate-error": "^4.0.1",
|
|
29
|
+
"debug": "^4.3.4",
|
|
30
|
+
"dir-glob": "^3.0.1",
|
|
31
|
+
"globby": "^13.1.4",
|
|
29
32
|
"http-proxy-agent": "^7.0.0",
|
|
30
33
|
"https-proxy-agent": "^7.0.0",
|
|
31
34
|
"issue-parser": "^6.0.0",
|
|
32
|
-
"lodash": "^4.17.
|
|
35
|
+
"lodash-es": "^4.17.21",
|
|
33
36
|
"mime": "^3.0.0",
|
|
34
|
-
"p-filter": "^
|
|
35
|
-
"url-join": "^
|
|
37
|
+
"p-filter": "^3.0.0",
|
|
38
|
+
"url-join": "^5.0.0"
|
|
36
39
|
},
|
|
37
40
|
"devDependencies": {
|
|
38
|
-
"ava": "5.
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"proxy": "1.0.2",
|
|
44
|
-
"proxyquire": "2.1.3",
|
|
41
|
+
"ava": "5.3.0",
|
|
42
|
+
"c8": "7.14.0",
|
|
43
|
+
"cpy": "10.1.0",
|
|
44
|
+
"fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
|
|
45
|
+
"prettier": "2.8.8",
|
|
45
46
|
"semantic-release": "21.0.2",
|
|
46
|
-
"server-destroy": "1.0.1",
|
|
47
47
|
"sinon": "15.1.0",
|
|
48
|
-
"tempy": "
|
|
49
|
-
"xo": "0.36.1"
|
|
48
|
+
"tempy": "3.0.0"
|
|
50
49
|
},
|
|
51
50
|
"engines": {
|
|
52
|
-
"node": ">=
|
|
51
|
+
"node": ">=18"
|
|
53
52
|
},
|
|
54
53
|
"files": [
|
|
55
54
|
"lib",
|
|
@@ -68,8 +67,8 @@
|
|
|
68
67
|
"version"
|
|
69
68
|
],
|
|
70
69
|
"license": "MIT",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
70
|
+
"exports": "./index.js",
|
|
71
|
+
"c8": {
|
|
73
72
|
"include": [
|
|
74
73
|
"lib/**/*.js",
|
|
75
74
|
"index.js"
|
|
@@ -82,11 +81,7 @@
|
|
|
82
81
|
"all": true
|
|
83
82
|
},
|
|
84
83
|
"peerDependencies": {
|
|
85
|
-
"semantic-release": ">=
|
|
86
|
-
},
|
|
87
|
-
"prettier": {
|
|
88
|
-
"printWidth": 120,
|
|
89
|
-
"trailingComma": "es5"
|
|
84
|
+
"semantic-release": ">=20.1.0"
|
|
90
85
|
},
|
|
91
86
|
"publishConfig": {
|
|
92
87
|
"access": "public",
|
|
@@ -98,25 +93,10 @@
|
|
|
98
93
|
},
|
|
99
94
|
"scripts": {
|
|
100
95
|
"codecov": "codecov -f coverage/coverage-final.json",
|
|
101
|
-
"lint": "
|
|
102
|
-
"
|
|
96
|
+
"lint": "prettier --check \"{lib,test}/**/*.{js,json,ts}\" \"*.{js,md,json}\" \".github/**/*.yml\"",
|
|
97
|
+
"lint:fix": "prettier --write \"{lib,test}/**/*.{js,json,ts}\" \"*.{js,md,json}\" \".github/**/*.yml\"",
|
|
103
98
|
"semantic-release": "semantic-release",
|
|
104
|
-
"test": "
|
|
105
|
-
"test:ci": "nyc ava -v"
|
|
106
|
-
},
|
|
107
|
-
"xo": {
|
|
108
|
-
"prettier": true,
|
|
109
|
-
"space": true,
|
|
110
|
-
"rules": {
|
|
111
|
-
"camelcase": [
|
|
112
|
-
"error",
|
|
113
|
-
{
|
|
114
|
-
"properties": "never"
|
|
115
|
-
}
|
|
116
|
-
],
|
|
117
|
-
"unicorn/string-content": "off",
|
|
118
|
-
"unicorn/no-reduce": "off"
|
|
119
|
-
}
|
|
99
|
+
"test": "c8 ava -v"
|
|
120
100
|
},
|
|
121
101
|
"renovate": {
|
|
122
102
|
"extends": [
|
package/lib/get-client.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const urljoin = require('url-join');
|
|
2
|
-
const {HttpProxyAgent} = require('http-proxy-agent');
|
|
3
|
-
const {HttpsProxyAgent} = require('https-proxy-agent');
|
|
4
|
-
|
|
5
|
-
const SemanticReleaseOctokit = require('./semantic-release-octokit');
|
|
6
|
-
|
|
7
|
-
module.exports = ({githubToken, githubUrl, githubApiPathPrefix, proxy}) => {
|
|
8
|
-
const baseUrl = githubUrl && urljoin(githubUrl, githubApiPathPrefix);
|
|
9
|
-
const octokit = new SemanticReleaseOctokit({
|
|
10
|
-
auth: `token ${githubToken}`,
|
|
11
|
-
baseUrl,
|
|
12
|
-
request: {
|
|
13
|
-
agent: proxy
|
|
14
|
-
? baseUrl && new URL(baseUrl).protocol.replace(':', '') === 'http'
|
|
15
|
-
? // Some `proxy.headers` need to be passed as second arguments since version 6 or 7
|
|
16
|
-
// For simplicity, we just pass the same proxy object twice. It works 🤷🏻
|
|
17
|
-
new HttpProxyAgent(proxy, proxy)
|
|
18
|
-
: new HttpsProxyAgent(proxy, proxy)
|
|
19
|
-
: undefined,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return octokit;
|
|
24
|
-
};
|