5
0
Fork 0
mirror of https://github.com/cycjimmy/semantic-release-action.git synced 2025-11-07 18:56:56 +00:00

refactor(inputs): remove redundant defaults and options

This commit is contained in:
cycjimmy 2019-10-26 22:40:30 +08:00
parent fd6487c160
commit 18455e9e99
4 changed files with 18 additions and 17 deletions

View file

@ -10,10 +10,8 @@ inputs:
default: master
extra_plugins:
description: 'Extra plugins for pre-install'
default: ''
dry_run:
description: 'Whether to run semantic release in "dry-run" mode. It will override the dryRun attribute in your configuration file'
default: ''
outputs:
new_release_published:
description: 'Whether a new release was published'

View file

@ -6,7 +6,7 @@ const inputs = require('./inputs.json');
* @returns {{}|{dryRun: boolean}}
*/
exports.handleDryRunOption = () => {
const dryRun = core.getInput(inputs.dry_run, {required: false}) || '';
const dryRun = core.getInput(inputs.dry_run);
switch (dryRun) {
case 'true':

View file

@ -16,7 +16,7 @@ const release = async () => {
await setUpJob();
await preInstallPlugins();
const branch = core.getInput(inputs.branch, {required: false}) || 'master';
const branch = core.getInput(inputs.branch) || 'master';
const result = await semanticRelease({
branch,
...(handleDryRunOption()),

View file

@ -1,15 +1,19 @@
const path = require('path');
const core = require('@actions/core');
const exec = require('./_exec');
const inputs = require('./inputs.json');
/**
* Pre-install plugins
* @returns {Promise<never>}
* @returns {Promise<void>}
*/
module.exports = async () => {
const extraPlugins = core.getInput('extra_plugins', {required: false}) || '';
const extraPlugins = core.getInput(inputs.extra_plugins);
if (!extraPlugins) {
return Promise.resolve();
}
if (extraPlugins) {
const _extraPlugins = extraPlugins
.replace(/['"]/g, '')
.replace(/[\n\r]/g, ' ');
@ -22,5 +26,4 @@ module.exports = async () => {
if (stderr) {
return Promise.reject(stderr);
}
}
};