@semantic-release/github 8.0.9 → 9.0.0-beta.1

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.
@@ -1,115 +1,197 @@
1
- const {inspect} = require('util');
2
- const {isString} = require('lodash');
3
- const pkg = require('../../package.json');
1
+ import { inspect } from "node:util";
2
+ import { createRequire } from "node:module";
3
+ const require = createRequire(import.meta.url);
4
4
 
5
- const [homepage] = pkg.homepage.split('#');
6
- const stringify = (object) =>
7
- isString(object) ? object : inspect(object, {breakLength: Infinity, depth: 2, maxArrayLength: 5});
8
- const linkify = (file) => `${homepage}/blob/master/${file}`;
5
+ import { isString } from "lodash-es";
6
+
7
+ const pkg = require("../../package.json");
8
+ const HOMEPAGE = pkg.homepage;
9
9
 
10
- module.exports = {
11
- EINVALIDASSETS: ({assets}) => ({
12
- message: 'Invalid `assets` option.',
10
+ const stringify = (object) =>
11
+ isString(object)
12
+ ? object
13
+ : inspect(object, {
14
+ breakLength: Number.POSITIVE_INFINITY,
15
+ depth: 2,
16
+ maxArrayLength: 5,
17
+ });
18
+ const linkify = (file) => `${HOMEPAGE}/blob/master/${file}`;
19
+
20
+ export function EINVALIDASSETS({ assets }) {
21
+ return {
22
+ message: "Invalid `assets` option.",
13
23
  details: `The [assets option](${linkify(
14
- 'README.md#assets'
24
+ "README.md#assets"
15
25
  )}) must be an \`Array\` of \`Strings\` or \`Objects\` with a \`path\` property.
16
26
 
17
27
  Your configuration for the \`assets\` option is \`${stringify(assets)}\`.`,
18
- }),
19
- EINVALIDSUCCESSCOMMENT: ({successComment}) => ({
20
- message: 'Invalid `successComment` option.',
28
+ };
29
+ }
30
+
31
+ export function EINVALIDSUCCESSCOMMENT({ successComment }) {
32
+ return {
33
+ message: "Invalid `successComment` option.",
21
34
  details: `The [successComment option](${linkify(
22
- 'README.md#successcomment'
35
+ "README.md#successcomment"
36
+ )}) if defined, must be a non empty \`String\`.
37
+
38
+ Your configuration for the \`successComment\` option is \`${stringify(
39
+ successComment
40
+ )}\`.`,
41
+ };
42
+ }
43
+
44
+ export function EINVALIDFAILTITLE({ failTitle }) {
45
+ return {
46
+ message: "Invalid `failTitle` option.",
47
+ details: `The [failTitle option](${linkify(
48
+ "README.md#failtitle"
49
+ )}) if defined, must be a non empty \`String\`.
50
+
51
+ Your configuration for the \`failTitle\` option is \`${stringify(
52
+ failTitle
53
+ )}\`.`,
54
+ };
55
+ }
56
+
57
+ export function EINVALIDFAILCOMMENT({ failComment }) {
58
+ return {
59
+ message: "Invalid `failComment` option.",
60
+ details: `The [failComment option](${linkify(
61
+ "README.md#failcomment"
23
62
  )}) if defined, must be a non empty \`String\`.
24
63
 
25
- Your configuration for the \`successComment\` option is \`${stringify(successComment)}\`.`,
26
- }),
27
- EINVALIDFAILTITLE: ({failTitle}) => ({
28
- message: 'Invalid `failTitle` option.',
29
- details: `The [failTitle option](${linkify('README.md#failtitle')}) if defined, must be a non empty \`String\`.
30
-
31
- Your configuration for the \`failTitle\` option is \`${stringify(failTitle)}\`.`,
32
- }),
33
- EINVALIDFAILCOMMENT: ({failComment}) => ({
34
- message: 'Invalid `failComment` option.',
35
- details: `The [failComment option](${linkify('README.md#failcomment')}) if defined, must be a non empty \`String\`.
36
-
37
- Your configuration for the \`failComment\` option is \`${stringify(failComment)}\`.`,
38
- }),
39
- EINVALIDLABELS: ({labels}) => ({
40
- message: 'Invalid `labels` option.',
64
+ Your configuration for the \`failComment\` option is \`${stringify(
65
+ failComment
66
+ )}\`.`,
67
+ };
68
+ }
69
+
70
+ export function EINVALIDLABELS({ labels }) {
71
+ return {
72
+ message: "Invalid `labels` option.",
41
73
  details: `The [labels option](${linkify(
42
- 'README.md#options'
74
+ "README.md#options"
43
75
  )}) if defined, must be an \`Array\` of non empty \`String\`.
44
76
 
45
77
  Your configuration for the \`labels\` option is \`${stringify(labels)}\`.`,
46
- }),
47
- EINVALIDASSIGNEES: ({assignees}) => ({
48
- message: 'Invalid `assignees` option.',
49
- details: `The [assignees option](${linkify('README.md#options')}) must be an \`Array\` of non empty \`Strings\`.
50
-
51
- Your configuration for the \`assignees\` option is \`${stringify(assignees)}\`.`,
52
- }),
53
- EINVALIDRELEASEDLABELS: ({releasedLabels}) => ({
54
- message: 'Invalid `releasedLabels` option.',
78
+ };
79
+ }
80
+
81
+ export function EINVALIDASSIGNEES({ assignees }) {
82
+ return {
83
+ message: "Invalid `assignees` option.",
84
+ details: `The [assignees option](${linkify(
85
+ "README.md#options"
86
+ )}) must be an \`Array\` of non empty \`Strings\`.
87
+
88
+ Your configuration for the \`assignees\` option is \`${stringify(
89
+ assignees
90
+ )}\`.`,
91
+ };
92
+ }
93
+
94
+ export function EINVALIDRELEASEDLABELS({ releasedLabels }) {
95
+ return {
96
+ message: "Invalid `releasedLabels` option.",
55
97
  details: `The [releasedLabels option](${linkify(
56
- 'README.md#options'
98
+ "README.md#options"
57
99
  )}) if defined, must be an \`Array\` of non empty \`String\`.
58
100
 
59
- Your configuration for the \`releasedLabels\` option is \`${stringify(releasedLabels)}\`.`,
60
- }),
61
- EINVALIDADDRELEASES: ({addReleases}) => ({
62
- message: 'Invalid `addReleases` option.',
63
- details: `The [addReleases option](${linkify('README.md#options')}) if defined, must be one of \`false|top|bottom\`.
64
-
65
- Your configuration for the \`addReleases\` option is \`${stringify(addReleases)}\`.`,
66
- }),
67
- EINVALIDGITHUBURL: () => ({
68
- message: 'The git repository URL is not a valid GitHub URL.',
101
+ Your configuration for the \`releasedLabels\` option is \`${stringify(
102
+ releasedLabels
103
+ )}\`.`,
104
+ };
105
+ }
106
+
107
+ export function EINVALIDADDRELEASES({ addReleases }) {
108
+ return {
109
+ message: "Invalid `addReleases` option.",
110
+ details: `The [addReleases option](${linkify(
111
+ "README.md#options"
112
+ )}) if defined, must be one of \`false|top|bottom\`.
113
+
114
+ Your configuration for the \`addReleases\` option is \`${stringify(
115
+ addReleases
116
+ )}\`.`,
117
+ };
118
+ }
119
+
120
+ export function EINVALIDDRAFTRELEASE({ draftRelease }) {
121
+ return {
122
+ message: "Invalid `draftRelease` option.",
123
+ details: `The [draftRelease option](${linkify(
124
+ "README.md#options"
125
+ )}) if defined, must be a \`Boolean\`.
126
+
127
+ Your configuration for the \`draftRelease\` option is \`${stringify(
128
+ draftRelease
129
+ )}\`.`,
130
+ };
131
+ }
132
+
133
+ export function EINVALIDGITHUBURL() {
134
+ return {
135
+ message: "The git repository URL is not a valid GitHub URL.",
69
136
  details: `The **semantic-release** \`repositoryUrl\` option must a valid GitHub URL with the format \`<GitHub_or_GHE_URL>/<owner>/<repo>.git\`.
70
137
 
71
138
  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.`,
72
- }),
73
- EINVALIDPROXY: ({proxy}) => ({
74
- message: 'Invalid `proxy` option.',
139
+ };
140
+ }
141
+
142
+ export function EINVALIDPROXY({ proxy }) {
143
+ return {
144
+ message: "Invalid `proxy` option.",
75
145
  details: `The [proxy option](${linkify(
76
- 'README.md#proxy'
146
+ "README.md#proxy"
77
147
  )}) must be a \`String\` or an \`Objects\` with a \`host\` and a \`port\` property.
78
148
 
79
149
  Your configuration for the \`proxy\` option is \`${stringify(proxy)}\`.`,
80
- }),
81
- EMISSINGREPO: ({owner, repo}) => ({
150
+ };
151
+ }
152
+
153
+ export function EMISSINGREPO({ owner, repo }) {
154
+ return {
82
155
  message: `The repository ${owner}/${repo} doesn't exist.`,
83
156
  details: `The **semantic-release** \`repositoryUrl\` option must refer to your GitHub repository. The repository must be accessible with the [GitHub API](https://developer.github.com/v3).
84
157
 
85
158
  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.
86
159
 
87
160
  If you are using [GitHub Enterprise](https://enterprise.github.com) please make sure to configure the \`githubUrl\` and \`githubApiPathPrefix\` [options](${linkify(
88
- 'README.md#options'
161
+ "README.md#options"
89
162
  )}).`,
90
- }),
91
- EGHNOPERMISSION: ({owner, repo}) => ({
163
+ };
164
+ }
165
+
166
+ export function EGHNOPERMISSION({ owner, repo }) {
167
+ return {
92
168
  message: `The GitHub token doesn't allow to push on the repository ${owner}/${repo}.`,
93
169
  details: `The user associated with the [GitHub token](${linkify(
94
- 'README.md#github-authentication'
170
+ "README.md#github-authentication"
95
171
  )}) configured in the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable must allows to push to the repository ${owner}/${repo}.
96
172
 
97
173
  Please make sure the GitHub user associated with the token is an [owner](https://help.github.com/articles/permission-levels-for-a-user-account-repository/#owner-access-on-a-repository-owned-by-a-user-account) or a [collaborator](https://help.github.com/articles/permission-levels-for-a-user-account-repository/#collaborator-access-on-a-repository-owned-by-a-user-account) if the reposotory belong to a user account or has [write permissions](https://help.github.com/articles/managing-team-access-to-an-organization-repository) if the repository [belongs to an organization](https://help.github.com/articles/repository-permission-levels-for-an-organization).`,
98
- }),
99
- EINVALIDGHTOKEN: ({owner, repo}) => ({
100
- message: 'Invalid GitHub token.',
174
+ };
175
+ }
176
+
177
+ export function EINVALIDGHTOKEN({ owner, repo }) {
178
+ return {
179
+ message: "Invalid GitHub token.",
101
180
  details: `The [GitHub token](${linkify(
102
- 'README.md#github-authentication'
181
+ "README.md#github-authentication"
103
182
  )}) configured in the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable must be a valid [personal token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line) allowing to push to the repository ${owner}/${repo}.
104
183
 
105
184
  Please make sure to set the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable in your CI with the exact value of the GitHub personal token.`,
106
- }),
107
- ENOGHTOKEN: ({owner, repo}) => ({
108
- message: 'No GitHub token specified.',
185
+ };
186
+ }
187
+
188
+ export function ENOGHTOKEN({ owner, repo }) {
189
+ return {
190
+ message: "No GitHub token specified.",
109
191
  details: `A [GitHub personal token](${linkify(
110
- 'README.md#github-authentication'
192
+ "README.md#github-authentication"
111
193
  )}) must be created and set in the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable on your CI environment.
112
194
 
113
195
  Please make sure to create a [GitHub personal token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line) and to set it in the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable on your CI environment. The token must allow to push to the repository ${owner}/${repo}.`,
114
- }),
115
- };
196
+ };
197
+ }
@@ -1,10 +1,8 @@
1
1
  /**
2
2
  * Default exponential backoff configuration for retries.
3
3
  */
4
- const RETRY_CONF = {
4
+ export const RETRY_CONF = {
5
5
  // By default, Octokit does not retry on 404s.
6
6
  // But we want to retry on 404s to account for replication lag.
7
7
  doNotRetry: [400, 401, 403, 422],
8
8
  };
9
-
10
- module.exports = {RETRY_CONF};
@@ -2,6 +2,4 @@
2
2
  * Default configuration for throttle.
3
3
  * @see https://github.com/octokit/plugin-throttling.js#options
4
4
  */
5
- const THROTTLE_CONF = {};
6
-
7
- module.exports = {THROTTLE_CONF};
5
+ export const THROTTLE_CONF = {};
package/lib/fail.js CHANGED
@@ -1,42 +1,61 @@
1
- const {template} = require('lodash');
2
- const debug = require('debug')('semantic-release:github');
3
- const parseGithubUrl = require('./parse-github-url');
4
- const {ISSUE_ID} = require('./definitions/constants');
5
- const resolveConfig = require('./resolve-config');
6
- const getClient = require('./get-client');
7
- const findSRIssues = require('./find-sr-issues');
8
- const getFailComment = require('./get-fail-comment');
1
+ import { template } from "lodash-es";
2
+ import debugFactory from "debug";
9
3
 
10
- module.exports = async (pluginConfig, context) => {
4
+ import parseGithubUrl from "./parse-github-url.js";
5
+ import { ISSUE_ID } from "./definitions/constants.js";
6
+ import resolveConfig from "./resolve-config.js";
7
+ import { toOctokitOptions, SemanticReleaseOctokit } from "./octokit.js";
8
+ import findSRIssues from "./find-sr-issues.js";
9
+ import getFailComment from "./get-fail-comment.js";
10
+
11
+ const debug = debugFactory("semantic-release:github");
12
+
13
+ export default async function fail(pluginConfig, context, { Octokit }) {
11
14
  const {
12
- options: {repositoryUrl},
15
+ options: { repositoryUrl },
13
16
  branch,
14
17
  errors,
15
18
  logger,
16
19
  } = context;
17
- const {githubToken, githubUrl, githubApiPathPrefix, proxy, failComment, failTitle, labels, assignees} = resolveConfig(
18
- pluginConfig,
19
- context
20
- );
20
+ const {
21
+ githubToken,
22
+ githubUrl,
23
+ githubApiPathPrefix,
24
+ proxy,
25
+ failComment,
26
+ failTitle,
27
+ labels,
28
+ assignees,
29
+ } = resolveConfig(pluginConfig, context);
21
30
 
22
31
  if (failComment === false || failTitle === false) {
23
- logger.log('Skip issue creation.');
32
+ logger.log("Skip issue creation.");
24
33
  } else {
25
- const octokit = getClient({githubToken, githubUrl, githubApiPathPrefix, proxy});
34
+ const octokit = new Octokit(
35
+ toOctokitOptions({ githubToken, githubUrl, githubApiPathPrefix, proxy })
36
+ );
26
37
  // In case the repo changed name, get the new `repo`/`owner` as the search API will not follow redirects
27
- const {data: repoData} = await octokit.request('GET /repos/{owner}/{repo}', parseGithubUrl(repositoryUrl));
28
- const [owner, repo] = repoData.full_name.split('/');
29
- const body = failComment ? template(failComment)({branch, errors}) : getFailComment(branch, errors);
38
+ const { data: repoData } = await octokit.request(
39
+ "GET /repos/{owner}/{repo}",
40
+ parseGithubUrl(repositoryUrl)
41
+ );
42
+ const [owner, repo] = repoData.full_name.split("/");
43
+ const body = failComment
44
+ ? template(failComment)({ branch, errors })
45
+ : getFailComment(branch, errors);
30
46
  const [srIssue] = await findSRIssues(octokit, failTitle, owner, repo);
31
47
 
32
48
  if (srIssue) {
33
- logger.log('Found existing semantic-release issue #%d.', srIssue.number);
34
- const comment = {owner, repo, issue_number: srIssue.number, body};
35
- debug('create comment: %O', comment);
49
+ logger.log("Found existing semantic-release issue #%d.", srIssue.number);
50
+ const comment = { owner, repo, issue_number: srIssue.number, body };
51
+ debug("create comment: %O", comment);
36
52
  const {
37
- data: {html_url: url},
38
- } = await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/comments', comment);
39
- logger.log('Added comment to issue #%d: %s.', srIssue.number, url);
53
+ data: { html_url: url },
54
+ } = await octokit.request(
55
+ "POST /repos/{owner}/{repo}/issues/{issue_number}/comments",
56
+ comment
57
+ );
58
+ logger.log("Added comment to issue #%d: %s.", srIssue.number, url);
40
59
  } else {
41
60
  const newIssue = {
42
61
  owner,
@@ -46,11 +65,11 @@ module.exports = async (pluginConfig, context) => {
46
65
  labels: labels || [],
47
66
  assignees,
48
67
  };
49
- debug('create issue: %O', newIssue);
68
+ debug("create issue: %O", newIssue);
50
69
  const {
51
- data: {html_url: url, number},
52
- } = await octokit.request('POST /repos/{owner}/{repo}/issues', newIssue);
53
- logger.log('Created issue #%d: %s.', number, url);
70
+ data: { html_url: url, number },
71
+ } = await octokit.request("POST /repos/{owner}/{repo}/issues", newIssue);
72
+ logger.log("Created issue #%d: %s.", number, url);
54
73
  }
55
74
  }
56
- };
75
+ }
@@ -1,9 +1,9 @@
1
- const {ISSUE_ID} = require('./definitions/constants');
1
+ import { ISSUE_ID } from "./definitions/constants.js";
2
2
 
3
- module.exports = async (octokit, title, owner, repo) => {
3
+ export default async (octokit, title, owner, repo) => {
4
4
  const {
5
- data: {items: issues},
6
- } = await octokit.request('GET /search/issues', {
5
+ data: { items: issues },
6
+ } = await octokit.request("GET /search/issues", {
7
7
  q: `in:title+repo:${owner}/${repo}+type:issue+state:open+${title}`,
8
8
  });
9
9
 
package/lib/get-error.js CHANGED
@@ -1,7 +1,8 @@
1
- const SemanticReleaseError = require('@semantic-release/error');
2
- const ERROR_DEFINITIONS = require('./definitions/errors');
1
+ import SemanticReleaseError from "@semantic-release/error";
3
2
 
4
- module.exports = (code, ctx = {}) => {
5
- const {message, details} = ERROR_DEFINITIONS[code](ctx);
3
+ import * as ERROR_DEFINITIONS from "./definitions/errors.js";
4
+
5
+ export default function getError(code, ctx = {}) {
6
+ const { message, details } = ERROR_DEFINITIONS[code](ctx);
6
7
  return new SemanticReleaseError(message, code, details);
7
- };
8
+ }
@@ -1,4 +1,4 @@
1
- const HOME_URL = 'https://github.com/semantic-release/semantic-release';
1
+ const HOME_URL = "https://github.com/semantic-release/semantic-release";
2
2
  const FAQ_URL = `${HOME_URL}/blob/caribou/docs/support/FAQ.md`;
3
3
  const GET_HELP_URL = `${HOME_URL}#get-help`;
4
4
  const USAGE_DOC_URL = `${HOME_URL}/blob/caribou/docs/usage/README.md`;
@@ -11,13 +11,14 @@ ${
11
11
  `Unfortunately this error doesn't have any additional information.${
12
12
  error.pluginName
13
13
  ? ` Feel free to kindly ask the author of the \`${error.pluginName}\` plugin to add more helpful information.`
14
- : ''
14
+ : ""
15
15
  }`
16
16
  }`;
17
17
 
18
- module.exports = (branch, errors) => `## :rotating_light: The automated release from the \`${
19
- branch.name
20
- }\` branch failed. :rotating_light:
18
+ export default function getFailComment(branch, errors) {
19
+ return `## :rotating_light: The automated release from the \`${
20
+ branch.name
21
+ }\` branch failed. :rotating_light:
21
22
 
22
23
  I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.
23
24
 
@@ -26,8 +27,8 @@ You can find below the list of errors reported by **semantic-release**. Each one
26
27
  Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
27
28
 
28
29
  Once all the errors are resolved, **semantic-release** will release your package the next time you push a commit to the \`${
29
- branch.name
30
- }\` branch. You can also manually restart the failed CI job that runs **semantic-release**.
30
+ branch.name
31
+ }\` branch. You can also manually restart the failed CI job that runs **semantic-release**.
31
32
 
32
33
  If you are not sure how to resolve this, here are some links that can help you:
33
34
  - [Usage documentation](${USAGE_DOC_URL})
@@ -38,10 +39,11 @@ If those don’t help, or if this issue is reporting something you think isn’t
38
39
 
39
40
  ---
40
41
 
41
- ${errors.map((error) => formatError(error)).join('\n\n---\n\n')}
42
+ ${errors.map((error) => formatError(error)).join("\n\n---\n\n")}
42
43
 
43
44
  ---
44
45
 
45
46
  Good luck with your project ✨
46
47
 
47
48
  Your **[semantic-release](${HOME_URL})** bot :package::rocket:`;
49
+ }
@@ -1,22 +1,25 @@
1
- const {RELEASE_NAME} = require('./definitions/constants');
1
+ import { RELEASE_NAME } from "./definitions/constants.js";
2
2
 
3
3
  const linkify = (releaseInfo) =>
4
4
  `${
5
5
  releaseInfo.url
6
- ? releaseInfo.url.startsWith('http')
6
+ ? releaseInfo.url.startsWith("http")
7
7
  ? `[${releaseInfo.name}](${releaseInfo.url})`
8
8
  : `${releaseInfo.name}: \`${releaseInfo.url}\``
9
9
  : `\`${releaseInfo.name}\``
10
10
  }`;
11
11
 
12
12
  const filterReleases = (releaseInfos) =>
13
- releaseInfos.filter((releaseInfo) => releaseInfo.name && releaseInfo.name !== RELEASE_NAME);
13
+ releaseInfos.filter(
14
+ (releaseInfo) => releaseInfo.name && releaseInfo.name !== RELEASE_NAME
15
+ );
14
16
 
15
- module.exports = (releaseInfos) =>
16
- `${
17
+ export default function getReleaseLinks(releaseInfos) {
18
+ return `${
17
19
  filterReleases(releaseInfos).length > 0
18
20
  ? `This release is also available on:\n${filterReleases(releaseInfos)
19
21
  .map((releaseInfo) => `- ${linkify(releaseInfo)}`)
20
- .join('\n')}`
21
- : ''
22
+ .join("\n")}`
23
+ : ""
22
24
  }`;
25
+ }
@@ -1,8 +1,11 @@
1
- module.exports = (base, commits, separator = '+') => {
1
+ export default function getSearchQueries(base, commits, separator = "+") {
2
2
  return commits.reduce((searches, commit) => {
3
3
  const lastSearch = searches[searches.length - 1];
4
4
 
5
- if (lastSearch && lastSearch.length + commit.length <= 256 - separator.length) {
5
+ if (
6
+ lastSearch &&
7
+ lastSearch.length + commit.length <= 256 - separator.length
8
+ ) {
6
9
  searches[searches.length - 1] = `${lastSearch}${separator}${commit}`;
7
10
  } else {
8
11
  searches.push(`${base}${separator}${commit}`);
@@ -10,4 +13,4 @@ module.exports = (base, commits, separator = '+') => {
10
13
 
11
14
  return searches;
12
15
  }, []);
13
- };
16
+ }
@@ -1,18 +1,25 @@
1
- const HOME_URL = 'https://github.com/semantic-release/semantic-release';
1
+ const HOME_URL = "https://github.com/semantic-release/semantic-release";
2
2
  const linkify = (releaseInfo) =>
3
- `${releaseInfo.url ? `[${releaseInfo.name}](${releaseInfo.url})` : `\`${releaseInfo.name}\``}`;
3
+ `${
4
+ releaseInfo.url
5
+ ? `[${releaseInfo.name}](${releaseInfo.url})`
6
+ : `\`${releaseInfo.name}\``
7
+ }`;
4
8
 
5
- module.exports = (issue, releaseInfos, nextRelease) =>
6
- `:tada: This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${
7
- nextRelease.version
8
- } :tada:${
9
+ export default function getSuccessComment(issue, releaseInfos, nextRelease) {
10
+ return `:tada: This ${
11
+ issue.pull_request ? "PR is included" : "issue has been resolved"
12
+ } in version ${nextRelease.version} :tada:${
9
13
  releaseInfos.length > 0
10
14
  ? `\n\nThe release is available on${
11
15
  releaseInfos.length === 1
12
16
  ? ` ${linkify(releaseInfos[0])}`
13
- : `:\n${releaseInfos.map((releaseInfo) => `- ${linkify(releaseInfo)}`).join('\n')}`
17
+ : `:\n${releaseInfos
18
+ .map((releaseInfo) => `- ${linkify(releaseInfo)}`)
19
+ .join("\n")}`
14
20
  }`
15
- : ''
21
+ : ""
16
22
  }
17
23
 
18
24
  Your **[semantic-release](${HOME_URL})** bot :package::rocket:`;
25
+ }