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:
parent
fd6487c160
commit
18455e9e99
4 changed files with 18 additions and 17 deletions
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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':
|
||||
|
|
|
|||
|
|
@ -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()),
|
||||
|
|
|
|||
|
|
@ -1,26 +1,29 @@
|
|||
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) {
|
||||
const _extraPlugins = extraPlugins
|
||||
.replace(/['"]/g, '')
|
||||
.replace(/[\n\r]/g, ' ');
|
||||
if (!extraPlugins) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const {stdout, stderr} = await exec(`npm install ${_extraPlugins}`, {
|
||||
cwd: path.resolve(__dirname)
|
||||
});
|
||||
core.debug(stdout);
|
||||
const _extraPlugins = extraPlugins
|
||||
.replace(/['"]/g, '')
|
||||
.replace(/[\n\r]/g, ' ');
|
||||
|
||||
if (stderr) {
|
||||
return Promise.reject(stderr);
|
||||
}
|
||||
const {stdout, stderr} = await exec(`npm install ${_extraPlugins}`, {
|
||||
cwd: path.resolve(__dirname)
|
||||
});
|
||||
core.debug(stdout);
|
||||
|
||||
if (stderr) {
|
||||
return Promise.reject(stderr);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue