@semantic-release/github
Advanced tools
Comparing version 4.2.17 to 4.2.18
@@ -8,4 +8,4 @@ const {isUndefined, castArray} = require('lodash'); | ||
successComment, | ||
failTitle, | ||
failComment, | ||
failTitle, | ||
labels, | ||
@@ -19,6 +19,6 @@ assignees, | ||
successComment, | ||
failTitle: isUndefined(failTitle) || failTitle === false ? 'The automated release is failing 🚨' : failTitle, | ||
failComment, | ||
failTitle: isUndefined(failTitle) || failTitle === false ? 'The automated release is failing 🚨' : failTitle, | ||
labels: isUndefined(labels) ? ['semantic-release'] : labels === false ? [] : castArray(labels), | ||
assignees: assignees ? castArray(assignees) : assignees, | ||
}); |
@@ -11,56 +11,26 @@ const {isString, isPlainObject, isUndefined, isArray} = require('lodash'); | ||
const isStringOrStringArray = value => isNonEmptyString(value) || (isArray(value) && value.every(isNonEmptyString)); | ||
const isArrayOf = validator => array => isArray(array) && array.every(value => validator(value)); | ||
const VALIDATORS = { | ||
assets: isArrayOf( | ||
asset => isStringOrStringArray(asset) || (isPlainObject(asset) && isStringOrStringArray(asset.path)) | ||
), | ||
successComment: isNonEmptyString, | ||
failTitle: isNonEmptyString, | ||
failComment: isNonEmptyString, | ||
labels: isArrayOf(isStringOrStringArray), | ||
assignees: isArrayOf(isStringOrStringArray), | ||
}; | ||
module.exports = async (pluginConfig, {options: {repositoryUrl}, logger}) => { | ||
const errors = []; | ||
const { | ||
githubToken, | ||
githubUrl, | ||
githubApiPathPrefix, | ||
assets, | ||
successComment, | ||
failComment, | ||
failTitle, | ||
labels, | ||
assignees, | ||
} = resolveConfig(pluginConfig); | ||
const {githubToken, githubUrl, githubApiPathPrefix, ...options} = resolveConfig(pluginConfig); | ||
if ( | ||
!isUndefined(assets) && | ||
assets !== false && | ||
!( | ||
isArray(assets) && | ||
assets.every(asset => isStringOrStringArray(asset) || (isPlainObject(asset) && isStringOrStringArray(asset.path))) | ||
) | ||
) { | ||
errors.push(getError('EINVALIDASSETS', {assets})); | ||
} | ||
const errors = Object.entries(options).reduce( | ||
(errors, [option, value]) => | ||
!isUndefined(value) && value !== false && !VALIDATORS[option](value) | ||
? [...errors, getError(`EINVALID${option.toUpperCase()}`, {[option]: value})] | ||
: errors, | ||
[] | ||
); | ||
if (!isUndefined(successComment) && successComment !== false && !isNonEmptyString(successComment)) { | ||
errors.push(getError('EINVALIDSUCCESSCOMMENT', {successComment})); | ||
} | ||
if (!isUndefined(failTitle) && failTitle !== false && !isNonEmptyString(failTitle)) { | ||
errors.push(getError('EINVALIDFAILTITLE', {failTitle})); | ||
} | ||
if (!isUndefined(failComment) && failComment !== false && !isNonEmptyString(failComment)) { | ||
errors.push(getError('EINVALIDFAILCOMMENT', {failComment})); | ||
} | ||
if ( | ||
!isUndefined(labels) && | ||
labels !== false && | ||
!(isArray(labels) && labels.every(label => isStringOrStringArray(label))) | ||
) { | ||
errors.push(getError('EINVALIDLABELS', {labels})); | ||
} | ||
if ( | ||
!isUndefined(assignees) && | ||
assignees !== false && | ||
!(isArray(assignees) && assignees.every(assignee => isStringOrStringArray(assignee))) | ||
) { | ||
errors.push(getError('EINVALIDASSIGNEES', {assignees})); | ||
} | ||
if (githubUrl) { | ||
@@ -67,0 +37,0 @@ logger.log('Verify GitHub authentication (%s)', urlJoin(githubUrl, githubApiPathPrefix)); |
{ | ||
"name": "@semantic-release/github", | ||
"description": "Set of semantic-release plugins for publishing a GitHub release", | ||
"version": "4.2.17", | ||
"version": "4.2.18", | ||
"author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)", | ||
@@ -41,6 +41,6 @@ "bugs": { | ||
"nock": "^9.1.0", | ||
"nyc": "^11.2.1", | ||
"nyc": "^12.0.1", | ||
"proxyquire": "^2.0.0", | ||
"semantic-release": "^15.0.0", | ||
"sinon": "^5.0.1", | ||
"sinon": "^6.0.0", | ||
"tempy": "^0.2.1", | ||
@@ -47,0 +47,0 @@ "xo": "^0.21.0" |
@@ -60,2 +60,4 @@ # @semantic-release/github | ||
**Note**: If you use a [shareable configuration](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/shareable-configurations.md#shareable-configurations) that defines one of these options you can set it to `false` in your [**semantic-release** configuration](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/configuration.md#configuration) in order to use the default value. | ||
#### assets | ||
@@ -149,3 +151,3 @@ | ||
Options can be set within the plugin definition in the Semantic-release configuration file: | ||
Options can be set within the plugin definition in the [**semantic-release** configuration](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/configuration.md#configuration): | ||
@@ -152,0 +154,0 @@ ```json |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
179
47925
626