Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

create release with body text sourced from file #50

Merged
merged 15 commits into from
Jul 1, 2020
Merged
Prev Previous commit
Next Next commit
switch to snake case and body_path
jbolda committed Apr 12, 2020
commit d16f41536bc296e8b906ee38df4bc6faae28ee2f
6 changes: 3 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -7866,11 +7866,11 @@ async function run() {
const draft = core.getInput('draft', { required: false }) === 'true';
const prerelease = core.getInput('prerelease', { required: false }) === 'true';

const bodyFromFile = core.getInput('bodyFromFile', { required: false });
const bodyPath = core.getInput('body_path', { required: false });
let bodyFileContent = null;
if (bodyFromFile !== '' && !!bodyFromFile) {
if (bodyPath !== '' && !!bodyPath) {
try {
bodyFileContent = fs.readFileSync(bodyFromFile, { encoding: 'utf8' });
bodyFileContent = fs.readFileSync(bodyPath, { encoding: 'utf8' });
} catch (error) {
core.setFailed(error.message);
}
6 changes: 3 additions & 3 deletions src/create-release.js
Original file line number Diff line number Diff line change
@@ -20,11 +20,11 @@ async function run() {
const draft = core.getInput('draft', { required: false }) === 'true';
const prerelease = core.getInput('prerelease', { required: false }) === 'true';

const bodyFromFile = core.getInput('bodyFromFile', { required: false });
const bodyPath = core.getInput('body_path', { required: false });
let bodyFileContent = null;
if (bodyFromFile !== '' && !!bodyFromFile) {
if (bodyPath !== '' && !!bodyPath) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't speak to the style that the actions team prefers, but bodyPath !== '' && is redundant, here. (The boolean value of the empty string is false.) Which would allow further reduction to just if(bodyPath). There's no reason to force cast to an actual boolean here because the type casting is already handled by falsiness.

try {
bodyFileContent = fs.readFileSync(bodyFromFile, { encoding: 'utf8' });
bodyFileContent = fs.readFileSync(bodyPath, { encoding: 'utf8' });
} catch (error) {
core.setFailed(error.message);
}