Skip to content

Commit 34c0afd

Browse files
authoredSep 26, 2023
feat: add discussionCategoryName option (#702)
1 parent 9e2678c commit 34c0afd

9 files changed

+325
-29
lines changed
 

‎README.md

+17-16
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,23 @@ When using the _GITHUB_TOKEN_, the **minimum required permissions** are:
7979

8080
### Options
8181

82-
| Option | Description | Default |
83-
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
84-
| `githubUrl` | The GitHub Enterprise endpoint. | `GH_URL` or `GITHUB_URL` environment variable. |
85-
| `githubApiPathPrefix` | The GitHub Enterprise API prefix. | `GH_PREFIX` or `GITHUB_PREFIX` environment variable. |
86-
| `proxy` | The proxy to use to access the GitHub API. Set to `false` to disable usage of proxy. See [proxy](#proxy). | `HTTP_PROXY` environment variable. |
87-
| `assets` | An array of files to upload to the release. See [assets](#assets). | - |
88-
| `successComment` | The comment to add to each issue and pull request resolved by the release. Set to `false` to disable commenting on issues and pull requests. See [successComment](#successcomment). | `:tada: This issue has been resolved in version ${nextRelease.version} :tada:\n\nThe release is available on [GitHub release](<github_release_url>)` |
89-
| `failComment` | The content of the issue created when a release fails. Set to `false` to disable opening an issue when a release fails. See [failComment](#failcomment). | Friendly message with links to **semantic-release** documentation and support, with the list of errors that caused the release to fail. |
90-
| `failTitle` | The title of the issue created when a release fails. Set to `false` to disable opening an issue when a release fails. | `The automated release is failing 🚨` |
91-
| `labels` | The [labels](https://help.github.com/articles/about-labels) to add to the issue created when a release fails. Set to `false` to not add any label. | `['semantic-release']` |
92-
| `assignees` | The [assignees](https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users) to add to the issue created when a release fails. | - |
93-
| `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}\` : "" %>']- |
94-
| `addReleases` | Will add release links to the GitHub Release. Can be `false`, `"bottom"` or `"top"`. See [addReleases](#addReleases). | `false` |
95-
| `draftRelease` | A boolean indicating if a GitHub Draft Release should be created instead of publishing an actual GitHub Release. | `false` |
96-
| `releaseNameTemplate` | A [Lodash template](https://lodash.com/docs#template) to customize the github release's name | `<%= nextverison.name %>` |
97-
| `releaseBodyTemplate` | A [Lodash template](https://lodash.com/docs#template) to customize the github release's body | `<%= nextverison.notes %>` |
82+
| Option | Description | Default |
83+
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
84+
| `githubUrl` | The GitHub Enterprise endpoint. | `GH_URL` or `GITHUB_URL` environment variable. |
85+
| `githubApiPathPrefix` | The GitHub Enterprise API prefix. | `GH_PREFIX` or `GITHUB_PREFIX` environment variable. |
86+
| `proxy` | The proxy to use to access the GitHub API. Set to `false` to disable usage of proxy. See [proxy](#proxy). | `HTTP_PROXY` environment variable. |
87+
| `assets` | An array of files to upload to the release. See [assets](#assets). | - |
88+
| `successComment` | The comment to add to each issue and pull request resolved by the release. Set to `false` to disable commenting on issues and pull requests. See [successComment](#successcomment). | `:tada: This issue has been resolved in version ${nextRelease.version} :tada:\n\nThe release is available on [GitHub release](<github_release_url>)` |
89+
| `failComment` | The content of the issue created when a release fails. Set to `false` to disable opening an issue when a release fails. See [failComment](#failcomment). | Friendly message with links to **semantic-release** documentation and support, with the list of errors that caused the release to fail. |
90+
| `failTitle` | The title of the issue created when a release fails. Set to `false` to disable opening an issue when a release fails. | `The automated release is failing 🚨` |
91+
| `labels` | The [labels](https://help.github.com/articles/about-labels) to add to the issue created when a release fails. Set to `false` to not add any label. | `['semantic-release']` |
92+
| `assignees` | The [assignees](https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users) to add to the issue created when a release fails. | - |
93+
| `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}\` : "" %>']- |
94+
| `addReleases` | Will add release links to the GitHub Release. Can be `false`, `"bottom"` or `"top"`. See [addReleases](#addReleases). | `false` |
95+
| `draftRelease` | A boolean indicating if a GitHub Draft Release should be created instead of publishing an actual GitHub Release. | `false` |
96+
| `releaseNameTemplate` | A [Lodash template](https://lodash.com/docs#template) to customize the github release's name | `<%= nextverison.name %>` |
97+
| `releaseBodyTemplate` | A [Lodash template](https://lodash.com/docs#template) to customize the github release's body | `<%= nextverison.notes %>` |
98+
| `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` |
9899

99100
#### proxy
100101

‎index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function verifyConditions(
1717
{ Octokit = SemanticReleaseOctokit } = {},
1818
) {
1919
const { options } = context;
20-
// If the GitHub publish plugin is used and has `assets`, `successComment`, `failComment`, `failTitle`, `labels` or `assignees` configured, validate it now in order to prevent any release if the configuration is wrong
20+
// If the GitHub publish plugin is used and has `assets`, `successComment`, `failComment`, `failTitle`, `labels`, `discussionCategoryName` or `assignees` configured, validate it now in order to prevent any release if the configuration is wrong
2121
if (options.publish) {
2222
const publishPlugin =
2323
castArray(options.publish).find(
@@ -42,6 +42,10 @@ export async function verifyConditions(
4242
pluginConfig.assignees,
4343
publishPlugin.assignees,
4444
);
45+
pluginConfig.discussionCategoryName = defaultTo(
46+
pluginConfig.discussionCategoryName,
47+
publishPlugin.discussionCategoryName,
48+
);
4549
}
4650

4751
await verifyGitHub(pluginConfig, context, { Octokit });

‎lib/definitions/errors.js

+13
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,16 @@ Your configuration for the \`releaseNameTemplate\` option is \`${stringify(
221221
)}\`.`,
222222
};
223223
}
224+
225+
export function EINVALIDDISCUSSIONCATEGORYNAME({ discussionCategoryName }) {
226+
return {
227+
message: "Invalid `discussionCategoryName` option.",
228+
details: `The [discussionCategoryName option](${linkify(
229+
"README.md#discussionCategoryName",
230+
)}) if defined, must be a non empty \`String\`.
231+
232+
Your configuration for the \`discussionCategoryName\` option is \`${stringify(
233+
discussionCategoryName,
234+
)}\`.`,
235+
};
236+
}

‎lib/publish.js

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default async function publish(pluginConfig, context, { Octokit }) {
3131
draftRelease,
3232
releaseNameTemplate,
3333
releaseBodyTemplate,
34+
discussionCategoryName,
3435
} = resolveConfig(pluginConfig, context);
3536
const { owner, repo } = parseGithubUrl(repositoryUrl);
3637
const octokit = new Octokit(
@@ -53,6 +54,11 @@ export default async function publish(pluginConfig, context, { Octokit }) {
5354

5455
debug("release object: %O", release);
5556

57+
// If discussionCategoryName is not undefined or false
58+
if (discussionCategoryName) {
59+
release.discussion_category_name = discussionCategoryName;
60+
}
61+
5662
const draftReleaseOptions = { ...release, draft: true };
5763

5864
// When there are no assets, we publish a release directly.

‎lib/resolve-config.js

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default function resolveConfig(
1616
draftRelease,
1717
releaseNameTemplate,
1818
releaseBodyTemplate,
19+
discussionCategoryName,
1920
},
2021
{ env },
2122
) {
@@ -52,5 +53,8 @@ export default function resolveConfig(
5253
releaseNameTemplate: !isNil(releaseNameTemplate)
5354
? releaseNameTemplate
5455
: "<%= nextRelease.name %>",
56+
discussionCategoryName: isNil(discussionCategoryName)
57+
? false
58+
: discussionCategoryName,
5559
};
5660
}

‎lib/verify.js

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const VALIDATORS = {
4747
draftRelease: isBoolean,
4848
releaseBodyTemplate: isNonEmptyString,
4949
releaseNameTemplate: isNonEmptyString,
50+
discussionCategoryName: canBeDisabled(isNonEmptyString),
5051
};
5152

5253
export default async function verify(pluginConfig, context, { Octokit }) {

‎test/integration.test.js

+18-6
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ test("Throw SemanticReleaseError if invalid config", async (t) => {
121121
const failTitle = 42;
122122
const labels = 42;
123123
const assignees = 42;
124+
const discussionCategoryName = 42;
124125
const options = {
125126
publish: [
126127
{ path: "@semantic-release/npm" },
@@ -132,6 +133,7 @@ test("Throw SemanticReleaseError if invalid config", async (t) => {
132133
failTitle,
133134
labels,
134135
assignees,
136+
discussionCategoryName,
135137
},
136138
],
137139
repositoryUrl: "invalid_url",
@@ -163,9 +165,11 @@ test("Throw SemanticReleaseError if invalid config", async (t) => {
163165
t.is(errors[5].name, "SemanticReleaseError");
164166
t.is(errors[5].code, "EINVALIDASSIGNEES");
165167
t.is(errors[6].name, "SemanticReleaseError");
166-
t.is(errors[6].code, "EINVALIDGITHUBURL");
168+
t.is(errors[6].code, "EINVALIDDISCUSSIONCATEGORYNAME");
167169
t.is(errors[7].name, "SemanticReleaseError");
168-
t.is(errors[7].code, "ENOGHTOKEN");
170+
t.is(errors[7].code, "EINVALIDGITHUBURL");
171+
t.is(errors[8].name, "SemanticReleaseError");
172+
t.is(errors[8].code, "ENOGHTOKEN");
169173
});
170174

171175
test("Publish a release with an array of assets", async (t) => {
@@ -219,7 +223,9 @@ test("Publish a release with an array of assets", async (t) => {
219223
`${uploadOrigin}${uploadUri}?name=${encodeURIComponent(
220224
"upload_file_name.txt",
221225
)}&`,
222-
{ browser_download_url: assetUrl },
226+
{
227+
browser_download_url: assetUrl,
228+
},
223229
)
224230
.postOnce(
225231
`${uploadOrigin}${uploadUri}?name=${encodeURIComponent(
@@ -676,12 +682,16 @@ test("Verify, release and notify success", async (t) => {
676682
`${uploadOrigin}${uploadUri}?name=other_file.txt&label=${encodeURIComponent(
677683
"Other File",
678684
)}`,
679-
{ browser_download_url: otherAssetUrl },
685+
{
686+
browser_download_url: otherAssetUrl,
687+
},
680688
)
681689

682690
.postOnce(
683691
`https://api.github.local/repos/${owner}/${repo}/issues/1/comments`,
684-
{ html_url: "https://github.com/successcomment-1" },
692+
{
693+
html_url: "https://github.com/successcomment-1",
694+
},
685695
);
686696

687697
await t.notThrowsAsync(
@@ -804,7 +814,9 @@ test("Verify, update release and notify success", async (t) => {
804814
)
805815
.postOnce(
806816
`https://api.github.local/repos/${owner}/${repo}/issues/1/comments`,
807-
{ html_url: "https://github.com/successcomment-1" },
817+
{
818+
html_url: "https://github.com/successcomment-1",
819+
},
808820
)
809821
.postOnce(
810822
`https://api.github.local/repos/${owner}/${repo}/issues/1/labels`,

‎test/publish.test.js

+128-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test.beforeEach((t) => {
1818
t.context.logger = { log: t.context.log, error: t.context.error };
1919
});
2020

21-
test("Publish a release", async (t) => {
21+
test("Publish a release without creating discussion", async (t) => {
2222
const owner = "test_user";
2323
const repo = "test_repo";
2424
const env = { GITHUB_TOKEN: "github_token" };
@@ -78,6 +78,68 @@ test("Publish a release", async (t) => {
7878
t.true(fetch.done());
7979
});
8080

81+
test("Publish a release and create discussion", async (t) => {
82+
const owner = "test_user";
83+
const repo = "test_repo";
84+
const env = { GITHUB_TOKEN: "github_token" };
85+
const pluginConfig = { discussionCategoryName: "Announcements" };
86+
const nextRelease = {
87+
gitTag: "v1.0.0",
88+
name: "v1.0.0",
89+
notes: "Test release note body",
90+
version: "v1.0.0",
91+
};
92+
const options = { repositoryUrl: `https://github.com/${owner}/${repo}.git` };
93+
const releaseUrl = `https://github.com/${owner}/${repo}/releases/${nextRelease.version}`;
94+
const releaseId = 1;
95+
const uploadUri = `/api/uploads/repos/${owner}/${repo}/releases/${releaseId}/assets`;
96+
const uploadUrl = `https://github.com${uploadUri}{?name,label}`;
97+
const branch = "test_branch";
98+
99+
const fetch = fetchMock.sandbox().postOnce(
100+
`https://api.github.local/repos/${owner}/${repo}/releases`,
101+
{
102+
upload_url: uploadUrl,
103+
html_url: releaseUrl,
104+
},
105+
{
106+
body: {
107+
tag_name: nextRelease.gitTag,
108+
target_commitish: branch,
109+
name: nextRelease.name,
110+
body: nextRelease.notes,
111+
prerelease: false,
112+
discussion_category_name: pluginConfig.discussionCategoryName,
113+
},
114+
},
115+
);
116+
117+
const result = await publish(
118+
pluginConfig,
119+
{
120+
cwd,
121+
env,
122+
options,
123+
branch: { name: branch, type: "release", main: true },
124+
nextRelease,
125+
logger: t.context.logger,
126+
},
127+
{
128+
Octokit: TestOctokit.defaults((options) => ({
129+
...options,
130+
request: { ...options.request, fetch },
131+
})),
132+
},
133+
);
134+
135+
t.is(result.url, releaseUrl);
136+
t.deepEqual(t.context.log.args[0], [
137+
"Published GitHub release: %s",
138+
releaseUrl,
139+
]);
140+
t.true(fetch.done());
141+
});
142+
81143
test("Publish a release on a channel", async (t) => {
82144
const owner = "test_user";
83145
const repo = "test_repo";
@@ -138,7 +200,7 @@ test("Publish a release on a channel", async (t) => {
138200
t.true(fetch.done());
139201
});
140202

141-
test("Publish a prerelease", async (t) => {
203+
test("Publish a prerelease wihtout creating discussion", async (t) => {
142204
const owner = "test_user";
143205
const repo = "test_repo";
144206
const env = { GITHUB_TOKEN: "github_token" };
@@ -198,6 +260,67 @@ test("Publish a prerelease", async (t) => {
198260
t.true(fetch.done());
199261
});
200262

263+
test("Publish a prerelease and create discussion", async (t) => {
264+
const owner = "test_user";
265+
const repo = "test_repo";
266+
const env = { GITHUB_TOKEN: "github_token" };
267+
const pluginConfig = { discussionCategoryName: "Announcements" };
268+
const nextRelease = {
269+
gitTag: "v1.0.0",
270+
name: "v1.0.0",
271+
notes: "Test release note body",
272+
};
273+
const options = { repositoryUrl: `https://github.com/${owner}/${repo}.git` };
274+
const releaseUrl = `https://github.com/${owner}/${repo}/releases/${nextRelease.version}`;
275+
const releaseId = 1;
276+
const uploadUri = `/api/uploads/repos/${owner}/${repo}/releases/${releaseId}/assets`;
277+
const uploadUrl = `https://github.com${uploadUri}{?name,label}`;
278+
const branch = "test_branch";
279+
280+
const fetch = fetchMock.sandbox().postOnce(
281+
`https://api.github.local/repos/${owner}/${repo}/releases`,
282+
{
283+
upload_url: uploadUrl,
284+
html_url: releaseUrl,
285+
},
286+
{
287+
body: {
288+
tag_name: nextRelease.gitTag,
289+
target_commitish: branch,
290+
name: nextRelease.name,
291+
body: nextRelease.notes,
292+
prerelease: true,
293+
discussion_category_name: pluginConfig.discussionCategoryName,
294+
},
295+
},
296+
);
297+
298+
const result = await publish(
299+
pluginConfig,
300+
{
301+
cwd,
302+
env,
303+
options,
304+
branch: { name: branch, type: "prerelease", channel: "beta" },
305+
nextRelease,
306+
logger: t.context.logger,
307+
},
308+
{
309+
Octokit: TestOctokit.defaults((options) => ({
310+
...options,
311+
request: { ...options.request, fetch },
312+
})),
313+
},
314+
);
315+
316+
t.is(result.url, releaseUrl);
317+
t.deepEqual(t.context.log.args[0], [
318+
"Published GitHub release: %s",
319+
releaseUrl,
320+
]);
321+
t.true(fetch.done());
322+
});
323+
201324
test("Publish a maintenance release", async (t) => {
202325
const owner = "test_user";
203326
const repo = "test_repo";
@@ -405,7 +528,9 @@ test("Publish a release with one asset and custom github url", async (t) => {
405528
`${env.GH_URL}${uploadUri}?name=${encodeURIComponent(
406529
"upload.txt",
407530
)}&label=${encodeURIComponent("A text file")}`,
408-
{ browser_download_url: assetUrl },
531+
{
532+
browser_download_url: assetUrl,
533+
},
409534
);
410535

411536
const result = await publish(

‎test/verify.test.js

+133-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ test("Verify package, token and repository access", async (t) => {
2525
const failTitle = "Test title";
2626
const failComment = "Test comment";
2727
const labels = ["semantic-release"];
28+
const discussionCategoryName = "Announcements";
2829

2930
const fetch = fetchMock
3031
.sandbox()
@@ -34,7 +35,15 @@ test("Verify package, token and repository access", async (t) => {
3435

3536
await t.notThrowsAsync(
3637
verify(
37-
{ proxy, assets, successComment, failTitle, failComment, labels },
38+
{
39+
proxy,
40+
assets,
41+
successComment,
42+
failTitle,
43+
failComment,
44+
labels,
45+
discussionCategoryName,
46+
},
3847
{
3948
env,
4049
options: {
@@ -53,7 +62,7 @@ test("Verify package, token and repository access", async (t) => {
5362
t.true(fetch.done());
5463
});
5564

56-
test('Verify package, token and repository access with "proxy", "asset", "successComment", "failTitle", "failComment" and "label" set to "null"', async (t) => {
65+
test('Verify package, token and repository access with "proxy", "asset", "discussionCategoryName", "successComment", "failTitle", "failComment" and "label" set to "null"', async (t) => {
5766
const owner = "test_user";
5867
const repo = "test_repo";
5968
const env = { GH_TOKEN: "github_token" };
@@ -63,6 +72,7 @@ test('Verify package, token and repository access with "proxy", "asset", "succes
6372
const failTitle = null;
6473
const failComment = null;
6574
const labels = null;
75+
const discussionCategoryName = null;
6676

6777
const fetch = fetchMock
6878
.sandbox()
@@ -72,7 +82,15 @@ test('Verify package, token and repository access with "proxy", "asset", "succes
7282

7383
await t.notThrowsAsync(
7484
verify(
75-
{ proxy, assets, successComment, failTitle, failComment, labels },
85+
{
86+
proxy,
87+
assets,
88+
successComment,
89+
failTitle,
90+
failComment,
91+
labels,
92+
discussionCategoryName,
93+
},
7694
{
7795
env,
7896
options: {
@@ -781,6 +799,7 @@ test("Verify if run in GitHub Action", async (t) => {
781799
const failTitle = "Test title";
782800
const failComment = "Test comment";
783801
const labels = ["semantic-release"];
802+
const discussionCategoryName = "Announcements";
784803

785804
await t.notThrowsAsync(
786805
verify(
@@ -1459,6 +1478,117 @@ test('Throw SemanticReleaseError if "failTitle" option is a whitespace String',
14591478
t.true(fetch.done());
14601479
});
14611480

1481+
test('Throw SemanticReleaseError if "discussionCategoryName" option is not a String', async (t) => {
1482+
const owner = "test_user";
1483+
const repo = "test_repo";
1484+
const env = { GH_TOKEN: "github_token" };
1485+
const discussionCategoryName = 42;
1486+
1487+
const fetch = fetchMock
1488+
.sandbox()
1489+
.getOnce(`https://api.github.local/repos/${owner}/${repo}`, {
1490+
permissions: { push: true },
1491+
});
1492+
1493+
const {
1494+
errors: [error, ...errors],
1495+
} = await t.throwsAsync(
1496+
verify(
1497+
{ discussionCategoryName },
1498+
{
1499+
env,
1500+
options: { repositoryUrl: `https://github.com/${owner}/${repo}.git` },
1501+
logger: t.context.logger,
1502+
},
1503+
{
1504+
Octokit: TestOctokit.defaults((options) => ({
1505+
...options,
1506+
request: { ...options.request, fetch },
1507+
})),
1508+
},
1509+
),
1510+
);
1511+
1512+
t.is(errors.length, 0);
1513+
t.is(error.name, "SemanticReleaseError");
1514+
t.is(error.code, "EINVALIDDISCUSSIONCATEGORYNAME");
1515+
t.true(fetch.done());
1516+
});
1517+
1518+
test('Throw SemanticReleaseError if "discussionCategoryName" option is an empty String', async (t) => {
1519+
const owner = "test_user";
1520+
const repo = "test_repo";
1521+
const env = { GH_TOKEN: "github_token" };
1522+
const discussionCategoryName = "";
1523+
1524+
const fetch = fetchMock
1525+
.sandbox()
1526+
.getOnce(`https://api.github.local/repos/${owner}/${repo}`, {
1527+
permissions: { push: true },
1528+
});
1529+
1530+
const {
1531+
errors: [error, ...errors],
1532+
} = await t.throwsAsync(
1533+
verify(
1534+
{ discussionCategoryName },
1535+
{
1536+
env,
1537+
options: { repositoryUrl: `https://github.com/${owner}/${repo}.git` },
1538+
logger: t.context.logger,
1539+
},
1540+
{
1541+
Octokit: TestOctokit.defaults((options) => ({
1542+
...options,
1543+
request: { ...options.request, fetch },
1544+
})),
1545+
},
1546+
),
1547+
);
1548+
1549+
t.is(errors.length, 0);
1550+
t.is(error.name, "SemanticReleaseError");
1551+
t.is(error.code, "EINVALIDDISCUSSIONCATEGORYNAME");
1552+
t.true(fetch.done());
1553+
});
1554+
1555+
test('Throw SemanticReleaseError if "discussionCategoryName" option is a whitespace String', async (t) => {
1556+
const owner = "test_user";
1557+
const repo = "test_repo";
1558+
const env = { GH_TOKEN: "github_token" };
1559+
const discussionCategoryName = " \n \r ";
1560+
1561+
const fetch = fetchMock
1562+
.sandbox()
1563+
.getOnce(`https://api.github.local/repos/${owner}/${repo}`, {
1564+
permissions: { push: true },
1565+
});
1566+
1567+
const {
1568+
errors: [error, ...errors],
1569+
} = await t.throwsAsync(
1570+
verify(
1571+
{ discussionCategoryName },
1572+
{
1573+
env,
1574+
options: { repositoryUrl: `https://github.com/${owner}/${repo}.git` },
1575+
logger: t.context.logger,
1576+
},
1577+
{
1578+
Octokit: TestOctokit.defaults((options) => ({
1579+
...options,
1580+
request: { ...options.request, fetch },
1581+
})),
1582+
},
1583+
),
1584+
);
1585+
1586+
t.is(errors.length, 0);
1587+
t.is(error.name, "SemanticReleaseError");
1588+
t.is(error.code, "EINVALIDDISCUSSIONCATEGORYNAME");
1589+
t.true(fetch.done());
1590+
});
1591+
14621592
test('Throw SemanticReleaseError if "failComment" option is not a String', async (t) => {
14631593
const owner = "test_user";
14641594
const repo = "test_repo";

0 commit comments

Comments
 (0)
Please sign in to comment.