@semantic-release/github 9.2.0 → 9.2.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.
@@ -170,7 +170,7 @@ export function EGHNOPERMISSION({ owner, repo }) {
170
170
  "README.md#github-authentication",
171
171
  )}) configured in the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable must allows to push to the repository ${owner}/${repo}.
172
172
 
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).`,
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 repository 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).`,
174
174
  };
175
175
  }
176
176
 
package/lib/publish.js CHANGED
@@ -54,11 +54,6 @@ export default async function publish(pluginConfig, context, { Octokit }) {
54
54
 
55
55
  debug("release object: %O", release);
56
56
 
57
- // If discussionCategoryName is not undefined or false
58
- if (discussionCategoryName) {
59
- release.discussion_category_name = discussionCategoryName;
60
- }
61
-
62
57
  const draftReleaseOptions = { ...release, draft: true };
63
58
 
64
59
  // When there are no assets, we publish a release directly.
@@ -76,12 +71,22 @@ export default async function publish(pluginConfig, context, { Octokit }) {
76
71
  return { url, name: RELEASE_NAME, id: releaseId };
77
72
  }
78
73
 
74
+ // add discussion_category_name if discussionCategoryName is not undefined or false
75
+ if (discussionCategoryName) {
76
+ release.discussion_category_name = discussionCategoryName;
77
+ }
78
+
79
79
  const {
80
- data: { html_url: url, id: releaseId },
80
+ data: { html_url: url, id: releaseId, discussion_url },
81
81
  } = await octokit.request("POST /repos/{owner}/{repo}/releases", release);
82
82
 
83
83
  logger.log("Published GitHub release: %s", url);
84
- return { url, name: RELEASE_NAME, id: releaseId };
84
+
85
+ if (discussionCategoryName) {
86
+ logger.log("Created GitHub release discussion: %s", discussion_url);
87
+ }
88
+
89
+ return { url, name: RELEASE_NAME, id: releaseId, discussion_url };
85
90
  }
86
91
 
87
92
  // We'll create a draft release, append the assets to it, and then publish it.
@@ -152,18 +157,30 @@ export default async function publish(pluginConfig, context, { Octokit }) {
152
157
  return { url: draftUrl, name: RELEASE_NAME, id: releaseId };
153
158
  }
154
159
 
160
+ const patchRelease = {
161
+ owner,
162
+ repo,
163
+ release_id: releaseId,
164
+ draft: false,
165
+ };
166
+
167
+ // add discussion_category_name if discussionCategoryName is not undefined or false
168
+ if (discussionCategoryName) {
169
+ patchRelease.discussion_category_name = discussionCategoryName;
170
+ }
171
+
155
172
  const {
156
- data: { html_url: url },
173
+ data: { html_url: url, discussion_url },
157
174
  } = await octokit.request(
158
175
  "PATCH /repos/{owner}/{repo}/releases/{release_id}",
159
- {
160
- owner,
161
- repo,
162
- release_id: releaseId,
163
- draft: false,
164
- },
176
+ patchRelease,
165
177
  );
166
178
 
167
179
  logger.log("Published GitHub release: %s", url);
168
- return { url, name: RELEASE_NAME, id: releaseId };
180
+
181
+ if (discussionCategoryName) {
182
+ logger.log("Created GitHub release discussion: %s", discussion_url);
183
+ }
184
+
185
+ return { url, name: RELEASE_NAME, id: releaseId, discussion_url };
169
186
  }
package/package.json CHANGED
@@ -1,12 +1,13 @@
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": "9.2.0",
4
+ "version": "9.2.2",
5
5
  "type": "module",
6
6
  "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
7
7
  "ava": {
8
8
  "files": [
9
- "test/**/*.test.js"
9
+ "test/**/*.test.js",
10
+ "!test/integration.test.js"
10
11
  ],
11
12
  "nodeArguments": [
12
13
  "--no-warnings"
@@ -17,7 +18,8 @@
17
18
  },
18
19
  "contributors": [
19
20
  "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)",
20
- "Gregor Martynus (https://twitter.com/gr2m)"
21
+ "Gregor Martynus (https://twitter.com/gr2m)",
22
+ "Matt Travi <npm@travi.org> (https://matt.travi.org/)"
21
23
  ],
22
24
  "dependencies": {
23
25
  "@octokit/core": "^5.0.0",
@@ -41,10 +43,15 @@
41
43
  "ava": "5.3.1",
42
44
  "c8": "8.0.1",
43
45
  "cpy": "10.1.0",
46
+ "cz-conventional-changelog": "3.3.0",
44
47
  "fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
48
+ "lockfile-lint": "4.12.1",
49
+ "ls-engines": "0.9.0",
50
+ "npm-run-all2": "6.1.1",
45
51
  "prettier": "3.0.3",
46
- "semantic-release": "22.0.5",
47
- "sinon": "16.0.0",
52
+ "publint": "0.2.5",
53
+ "semantic-release": "22.0.7",
54
+ "sinon": "17.0.1",
48
55
  "tempy": "3.1.0"
49
56
  },
50
57
  "engines": {
@@ -80,6 +87,19 @@
80
87
  ],
81
88
  "all": true
82
89
  },
90
+ "config": {
91
+ "commitizen": {
92
+ "path": "./node_modules/cz-conventional-changelog"
93
+ }
94
+ },
95
+ "lockfile-lint": {
96
+ "path": "package-lock.json",
97
+ "type": "npm",
98
+ "validate-https": true,
99
+ "allowed-hosts": [
100
+ "npm"
101
+ ]
102
+ },
83
103
  "peerDependencies": {
84
104
  "semantic-release": ">=20.1.0"
85
105
  },
@@ -93,10 +113,14 @@
93
113
  },
94
114
  "scripts": {
95
115
  "codecov": "codecov -f coverage/coverage-final.json",
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\"",
98
- "semantic-release": "semantic-release",
99
- "test": "c8 ava -v"
116
+ "lint:prettier": "prettier --check \"{lib,test}/**/*.{js,json,ts}\" \"*.{js,md,json}\" \".github/**/*.yml\"",
117
+ "lint:prettier:fix": "prettier --write \"{lib,test}/**/*.{js,json,ts}\" \"*.{js,md,json}\" \".github/**/*.yml\"",
118
+ "lint:lockfile": "lockfile-lint",
119
+ "lint:engines": "ls-engines",
120
+ "lint:publish": "publint --strict",
121
+ "test": "npm-run-all --print-label --parallel lint:* --parallel test:*",
122
+ "test:unit": "c8 ava --verbose",
123
+ "test:integration": "ava --verbose test/integration.test.js"
100
124
  },
101
125
  "renovate": {
102
126
  "extends": [