@semantic-release/github 7.1.0 → 7.2.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.
package/README.md CHANGED
@@ -3,9 +3,7 @@
3
3
  [**semantic-release**](https://github.com/semantic-release/semantic-release) plugin to publish a
4
4
  [GitHub release](https://help.github.com/articles/about-releases) and comment on released Pull Requests/Issues.
5
5
 
6
- [![Travis](https://img.shields.io/travis/semantic-release/github.svg)](https://travis-ci.org/semantic-release/github)
7
- [![Codecov](https://img.shields.io/codecov/c/github/semantic-release/github.svg)](https://codecov.io/gh/semantic-release/github)
8
- [![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/github.svg)](https://greenkeeper.io/)
6
+ [![Build Status](https://github.com/semantic-release/github/workflows/Test/badge.svg)](https://github.com/semantic-release/github/actions?query=workflow%3ATest+branch%3Amaster)
9
7
 
10
8
  [![npm latest version](https://img.shields.io/npm/v/@semantic-release/github/latest.svg)](https://www.npmjs.com/package/@semantic-release/github)
11
9
  [![npm next version](https://img.shields.io/npm/v/@semantic-release/github/next.svg)](https://www.npmjs.com/package/@semantic-release/github)
@@ -76,18 +74,19 @@ If you have actions that trigger on newly created releases, please use a generat
76
74
  |-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
77
75
  | `githubUrl` | The GitHub Enterprise endpoint. | `GH_URL` or `GITHUB_URL` environment variable. |
78
76
  | `githubApiPathPrefix` | The GitHub Enterprise API prefix. | `GH_PREFIX` or `GITHUB_PREFIX` environment variable. |
79
- | `proxy` | The proxy to use to access the GitHub API. See [proxy](#proxy). | `HTTP_PROXY` environment variable. |
77
+ | `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. |
80
78
  | `assets` | An array of files to upload to the release. See [assets](#assets). | - |
81
79
  | `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>)` |
82
80
  | `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. |
83
81
  | `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 🚨` |
84
82
  | `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']` |
85
83
  | `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. | - |
86
- | `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}\` : "" %>']` |
84
+ | `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}\` : "" %>']- |
85
+ | `addReleases` | Will add release links to the GitHub Release. Can be `false`, `"bottom"` or `"top"`. See [addReleases](#addReleases). | `false` |
87
86
 
88
87
  #### proxy
89
88
 
90
- Can be a the proxy URL or and `Object` with the following properties:
89
+ Can be `false`, a proxy URL or an `Object` with the following properties:
91
90
 
92
91
  | Property | Description | Default |
93
92
  |---------------|----------------------------------------------------------------|--------------------------------------|
@@ -1,5 +1,4 @@
1
1
  const path = require('path');
2
- const {basename} = require('path');
3
2
  const {isPlainObject, castArray, uniqWith, uniq} = require('lodash');
4
3
  const dirGlob = require('dir-glob');
5
4
  const globby = require('globby');
@@ -40,7 +39,7 @@ module.exports = async ({cwd}, assets) =>
40
39
  // - `path` of the matched file
41
40
  // - `name` based on the actual file name (to avoid assets with duplicate `name`)
42
41
  // - other properties of the original asset definition
43
- return globbed.map((file) => ({...asset, path: file, name: basename(file)}));
42
+ return globbed.map((file) => ({...asset, path: file, name: path.basename(file)}));
44
43
  }
45
44
 
46
45
  // If asset is an Object, output an Object definition with:
@@ -5,7 +5,7 @@ module.exports = (repositoryUrl) => {
5
5
  new URL(match ? `ssh://${auth ? `${auth}@` : ''}${host}/${path}` : repositoryUrl).pathname
6
6
  );
7
7
  return {owner, repo};
8
- } catch (_) {
8
+ } catch {
9
9
  return {};
10
10
  }
11
11
  };
package/lib/publish.js CHANGED
@@ -1,4 +1,4 @@
1
- const {basename, extname, resolve} = require('path');
1
+ const path = require('path');
2
2
  const {stat, readFile} = require('fs-extra');
3
3
  const {isPlainObject, template} = require('lodash');
4
4
  const mime = require('mime');
@@ -21,7 +21,15 @@ module.exports = async (pluginConfig, context) => {
21
21
  const {githubToken, githubUrl, githubApiPathPrefix, proxy, assets} = resolveConfig(pluginConfig, context);
22
22
  const {owner, repo} = parseGithubUrl(repositoryUrl);
23
23
  const github = getClient({githubToken, githubUrl, githubApiPathPrefix, proxy});
24
- const release = {owner, repo, tag_name: gitTag, name, body: notes, prerelease: isPrerelease(branch)};
24
+ const release = {
25
+ owner,
26
+ repo,
27
+ tag_name: gitTag,
28
+ target_commitish: branch.name,
29
+ name,
30
+ body: notes,
31
+ prerelease: isPrerelease(branch),
32
+ };
25
33
 
26
34
  debug('release object: %O', release);
27
35
 
@@ -53,8 +61,8 @@ module.exports = async (pluginConfig, context) => {
53
61
  let file;
54
62
 
55
63
  try {
56
- file = await stat(resolve(cwd, filePath));
57
- } catch (_) {
64
+ file = await stat(path.resolve(cwd, filePath));
65
+ } catch {
58
66
  logger.error('The asset %s cannot be read, and will be ignored.', filePath);
59
67
  return;
60
68
  }
@@ -64,13 +72,13 @@ module.exports = async (pluginConfig, context) => {
64
72
  return;
65
73
  }
66
74
 
67
- const fileName = template(asset.name || basename(filePath))(context);
75
+ const fileName = template(asset.name || path.basename(filePath))(context);
68
76
  const upload = {
69
77
  url: uploadUrl,
70
- data: await readFile(resolve(cwd, filePath)),
78
+ data: await readFile(path.resolve(cwd, filePath)),
71
79
  name: fileName,
72
80
  headers: {
73
- 'content-type': mime.getType(extname(fileName)) || 'text/plain',
81
+ 'content-type': mime.getType(path.extname(fileName)) || 'text/plain',
74
82
  'content-length': file.size,
75
83
  },
76
84
  };
@@ -19,7 +19,7 @@ module.exports = (
19
19
  githubToken: env.GH_TOKEN || env.GITHUB_TOKEN,
20
20
  githubUrl: githubUrl || env.GITHUB_API_URL || env.GH_URL || env.GITHUB_URL,
21
21
  githubApiPathPrefix: githubApiPathPrefix || env.GH_PREFIX || env.GITHUB_PREFIX || '',
22
- proxy: proxy || env.HTTP_PROXY,
22
+ proxy: isNil(proxy) ? env.http_proxy || env.HTTP_PROXY || false : proxy,
23
23
  assets: assets ? castArray(assets) : assets,
24
24
  successComment,
25
25
  failTitle: isNil(failTitle) ? 'The automated release is failing 🚨' : failTitle,
package/lib/success.js CHANGED
@@ -19,7 +19,6 @@ module.exports = async (pluginConfig, context) => {
19
19
  nextRelease,
20
20
  releases,
21
21
  logger,
22
- notes,
23
22
  } = context;
24
23
  const {
25
24
  githubToken,
@@ -152,8 +151,8 @@ module.exports = async (pluginConfig, context) => {
152
151
  if (!isEmpty(additionalReleases) && !isNil(ghRelaseId)) {
153
152
  const newBody =
154
153
  addReleases === 'top'
155
- ? additionalReleases.concat('\n---\n', notes)
156
- : notes.concat('\n---\n', additionalReleases);
154
+ ? additionalReleases.concat('\n---\n', nextRelease.notes)
155
+ : nextRelease.notes.concat('\n---\n', additionalReleases);
157
156
  await github.repos.updateRelease({owner, repo, release_id: ghRelaseId, body: newBody});
158
157
  }
159
158
  }
package/lib/verify.js CHANGED
@@ -14,8 +14,9 @@ const isArrayOf = (validator) => (array) => isArray(array) && array.every((value
14
14
  const canBeDisabled = (validator) => (value) => value === false || validator(value);
15
15
 
16
16
  const VALIDATORS = {
17
- proxy: (proxy) =>
18
- isNonEmptyString(proxy) || (isPlainObject(proxy) && isNonEmptyString(proxy.host) && isNumber(proxy.port)),
17
+ proxy: canBeDisabled(
18
+ (proxy) => isNonEmptyString(proxy) || (isPlainObject(proxy) && isNonEmptyString(proxy.host) && isNumber(proxy.port))
19
+ ),
19
20
  assets: isArrayOf(
20
21
  (asset) => isStringOrStringArray(asset) || (isPlainObject(asset) && isStringOrStringArray(asset.path))
21
22
  ),
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": "7.1.0",
4
+ "version": "7.2.1",
5
5
  "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
6
6
  "ava": {
7
7
  "files": [
@@ -16,7 +16,7 @@
16
16
  "Gregor Martynus (https://twitter.com/gr2m)"
17
17
  ],
18
18
  "dependencies": {
19
- "@octokit/rest": "^17.0.0",
19
+ "@octokit/rest": "^18.0.0",
20
20
  "@semantic-release/error": "^2.2.0",
21
21
  "aggregate-error": "^3.0.0",
22
22
  "bottleneck": "^2.18.1",
@@ -34,18 +34,18 @@
34
34
  "url-join": "^4.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "ava": "^3.1.0",
38
- "clear-module": "^4.0.0",
39
- "codecov": "^3.5.0",
40
- "nock": "^12.0.0",
41
- "nyc": "^15.0.0",
42
- "proxy": "^1.0.0",
43
- "proxyquire": "^2.0.0",
44
- "semantic-release": "^17.0.0",
45
- "server-destroy": "^1.0.1",
46
- "sinon": "^9.0.0",
47
- "tempy": "^0.5.0",
48
- "xo": "^0.30.0"
37
+ "ava": "3.15.0",
38
+ "clear-module": "4.1.1",
39
+ "codecov": "3.8.1",
40
+ "nock": "13.0.9",
41
+ "nyc": "15.1.0",
42
+ "proxy": "1.0.2",
43
+ "proxyquire": "2.1.3",
44
+ "semantic-release": "17.3.9",
45
+ "server-destroy": "1.0.1",
46
+ "sinon": "9.2.4",
47
+ "tempy": "1.0.0",
48
+ "xo": "0.36.1"
49
49
  },
50
50
  "engines": {
51
51
  "node": ">=10.18"
@@ -99,7 +99,8 @@
99
99
  "lint": "xo",
100
100
  "pretest": "npm run lint",
101
101
  "semantic-release": "semantic-release",
102
- "test": "nyc ava -v"
102
+ "test": "nyc ava -v",
103
+ "test:ci": "nyc ava -v"
103
104
  },
104
105
  "xo": {
105
106
  "prettier": true,
@@ -111,7 +112,13 @@
111
112
  "properties": "never"
112
113
  }
113
114
  ],
114
- "unicorn/string-content": "off"
115
+ "unicorn/string-content": "off",
116
+ "unicorn/no-reduce": "off"
115
117
  }
118
+ },
119
+ "renovate": {
120
+ "extends": [
121
+ "github>semantic-release/.github"
122
+ ]
116
123
  }
117
124
  }