Fixes #16 Add update specific omit inputs

This commit is contained in:
Nick Cipollo
2020-05-26 13:33:20 -04:00
parent 05b0499270
commit 6f236bd2ff
9 changed files with 226 additions and 85 deletions

View File

@@ -36,7 +36,7 @@ class Action {
}
}
async updateRelease(id) {
const response = await this.releases.update(id, this.inputs.tag, this.inputs.body, this.inputs.commit, this.inputs.draft, this.inputs.name, this.inputs.prerelease);
const response = await this.releases.update(id, this.inputs.tag, this.inputs.updatedReleaseBody, this.inputs.commit, this.inputs.draft, this.inputs.updatedReleaseName, this.inputs.prerelease);
return response.data;
}
noPublishedRelease(error) {
@@ -61,7 +61,7 @@ class Action {
return (_a = draftRelease) === null || _a === void 0 ? void 0 : _a.id;
}
async createRelease() {
const response = await this.releases.create(this.inputs.tag, this.inputs.body, this.inputs.commit, this.inputs.draft, this.inputs.name, this.inputs.prerelease);
const response = await this.releases.create(this.inputs.tag, this.inputs.createdReleaseBody, this.inputs.commit, this.inputs.draft, this.inputs.createdReleaseName, this.inputs.prerelease);
return response.data;
}
}

View File

@@ -33,9 +33,15 @@ class CoreInputs {
}
return [];
}
get body() {
if (CoreInputs.omitBody())
get createdReleaseBody() {
if (CoreInputs.omitBody)
return undefined;
return this.body;
}
static get omitBody() {
return core.getInput('omitBody') == 'true';
}
get body() {
const body = core.getInput('body');
if (body) {
return body;
@@ -46,27 +52,27 @@ class CoreInputs {
}
return '';
}
static omitBody() {
return core.getInput('omitBody') == 'true';
}
get commit() {
return core.getInput('commit');
}
get draft() {
const draft = core.getInput('draft');
return draft == 'true';
get createdReleaseName() {
if (CoreInputs.omitName)
return undefined;
return this.name;
}
static get omitName() {
return core.getInput('omitName') == 'true';
}
get name() {
if (CoreInputs.omitName())
return undefined;
const name = core.getInput('name');
if (name) {
return name;
}
return this.tag;
}
static omitName() {
return core.getInput('omitName') == 'true';
get draft() {
const draft = core.getInput('draft');
return draft == 'true';
}
get prerelease() {
const preRelease = core.getInput('prerelease');
@@ -91,6 +97,22 @@ class CoreInputs {
get token() {
return core.getInput('token', { required: true });
}
get updatedReleaseBody() {
if (CoreInputs.omitBody || CoreInputs.omitBodyDuringUpdate)
return undefined;
return this.body;
}
static get omitBodyDuringUpdate() {
return core.getInput('omitBodyDuringUpdate') == 'true';
}
get updatedReleaseName() {
if (CoreInputs.omitName || CoreInputs.omitNameDuringUpdate)
return undefined;
return this.name;
}
static get omitNameDuringUpdate() {
return core.getInput('omitNameDuringUpdate') == 'true';
}
stringFromFile(path) {
return fs_1.readFileSync(path, 'utf-8');
}