Fixes #185 Add omitDraftDuringUpdate input (#190)

This commit is contained in:
Nick Cipollo
2022-03-31 17:07:42 -04:00
committed by GitHub
parent c309084e8b
commit ffcd2d4c10
13 changed files with 203 additions and 137 deletions

3
.gitignore vendored
View File

@@ -93,3 +93,6 @@ fabric.properties
.idea/**/markdown-navigator/ .idea/**/markdown-navigator/
# End of https://www.gitignore.io/api/webstorm # End of https://www.gitignore.io/api/webstorm
# Coverage
coverage

View File

@@ -18,6 +18,7 @@ This action will create a GitHub release and optionally upload an artifact to it
| name | An optional name for the release. If this is omitted the tag will be used. | false | "" | | name | An optional name for the release. If this is omitted the tag will be used. | false | "" |
| omitBody | Indicates if the release body should be omitted. | false | false | | omitBody | Indicates if the release body should be omitted. | false | false |
| omitBodyDuringUpdate | Indicates if the release body should be omitted during updates. The body will still be applied for newly created releases. This will preserve the existing body during updates. | false | false | | omitBodyDuringUpdate | Indicates if the release body should be omitted during updates. The body will still be applied for newly created releases. This will preserve the existing body during updates. | false | false |
| omitDraftDuringUpdate | Indicates if the draft flag should be omitted during updates. The draft flag will still be applied for newly created releases. This will preserve the existing draft state during updates. | false | false |
| omitName | Indicates if the release name should be omitted. | false | false | | omitName | Indicates if the release name should be omitted. | false | false |
| omitNameDuringUpdate | Indicates if the release name should be omitted during updates. The name will still be applied for newly created releases. This will preserve the existing name during updates. | false | false | | omitNameDuringUpdate | Indicates if the release name should be omitted during updates. The name will still be applied for newly created releases. This will preserve the existing name during updates. | false | false |
| omitPrereleaseDuringUpdate | Indicates if the prerelease flag should be omitted during updates. The prerelease flag will still be applied for newly created releases. This will preserve the existing prerelease state during updates. | false | false | | omitPrereleaseDuringUpdate | Indicates if the prerelease flag should be omitted during updates. The prerelease flag will still be applied for newly created releases. This will preserve the existing prerelease state during updates. | false | false |

View File

@@ -22,20 +22,21 @@ const artifacts = [
] ]
const createBody = 'createBody' const createBody = 'createBody'
const createDraft = true
const createName = 'createName' const createName = 'createName'
const commit = 'commit' const commit = 'commit'
const discussionCategory = 'discussionCategory' const discussionCategory = 'discussionCategory'
const draft = true
const generateReleaseNotes = true const generateReleaseNotes = true
const id = 100 const id = 100
const createPrerelease = true const createPrerelease = true
const updatePrerelease = false
const releaseId = 101 const releaseId = 101
const replacesArtifacts = true const replacesArtifacts = true
const tag = 'tag' const tag = 'tag'
const token = 'token' const token = 'token'
const updateBody = 'updateBody' const updateBody = 'updateBody'
const updateDraft = false
const updateName = 'updateName' const updateName = 'updateName'
const updatePrerelease = false
const url = 'http://api.example.com' const url = 'http://api.example.com'
describe("Action", () => { describe("Action", () => {
@@ -56,7 +57,7 @@ describe("Action", () => {
createBody, createBody,
commit, commit,
discussionCategory, discussionCategory,
draft, createDraft,
generateReleaseNotes, generateReleaseNotes,
createName, createName,
createPrerelease) createPrerelease)
@@ -76,7 +77,7 @@ describe("Action", () => {
createBody, createBody,
commit, commit,
discussionCategory, discussionCategory,
draft, createDraft,
generateReleaseNotes, generateReleaseNotes,
createName, createName,
createPrerelease) createPrerelease)
@@ -101,7 +102,7 @@ describe("Action", () => {
createBody, createBody,
commit, commit,
discussionCategory, discussionCategory,
draft, createDraft,
generateReleaseNotes, generateReleaseNotes,
createName, createName,
createPrerelease createPrerelease
@@ -121,7 +122,7 @@ describe("Action", () => {
createBody, createBody,
commit, commit,
discussionCategory, discussionCategory,
draft, createDraft,
generateReleaseNotes, generateReleaseNotes,
createName, createName,
createPrerelease createPrerelease
@@ -164,7 +165,7 @@ describe("Action", () => {
createBody, createBody,
commit, commit,
discussionCategory, discussionCategory,
draft, createDraft,
generateReleaseNotes, generateReleaseNotes,
createName, createName,
createPrerelease createPrerelease
@@ -215,7 +216,7 @@ describe("Action", () => {
updateBody, updateBody,
commit, commit,
discussionCategory, discussionCategory,
draft, updateDraft,
updateName, updateName,
updatePrerelease updatePrerelease
) )
@@ -239,7 +240,7 @@ describe("Action", () => {
createBody, createBody,
commit, commit,
discussionCategory, discussionCategory,
draft, createDraft,
generateReleaseNotes, generateReleaseNotes,
createName, createName,
createPrerelease createPrerelease
@@ -266,7 +267,7 @@ describe("Action", () => {
updateBody, updateBody,
commit, commit,
discussionCategory, discussionCategory,
draft, updateDraft,
updateName, updateName,
updatePrerelease updatePrerelease
) )
@@ -285,7 +286,7 @@ describe("Action", () => {
updateBody, updateBody,
commit, commit,
discussionCategory, discussionCategory,
draft, updateDraft,
updateName, updateName,
updatePrerelease updatePrerelease
) )
@@ -304,7 +305,7 @@ describe("Action", () => {
updateBody, updateBody,
commit, commit,
discussionCategory, discussionCategory,
draft, updateDraft,
updateName, updateName,
updatePrerelease updatePrerelease
) )
@@ -362,11 +363,11 @@ describe("Action", () => {
allowUpdates: allowUpdates, allowUpdates: allowUpdates,
artifactErrorsFailBuild: true, artifactErrorsFailBuild: true,
artifacts: inputArtifact, artifacts: inputArtifact,
createdDraft: createDraft,
createdReleaseBody: createBody, createdReleaseBody: createBody,
createdReleaseName: createName, createdReleaseName: createName,
commit: commit, commit: commit,
discussionCategory: discussionCategory, discussionCategory: discussionCategory,
draft: draft,
generateReleaseNotes: true, generateReleaseNotes: true,
owner: "owner", owner: "owner",
createdPrerelease: createPrerelease, createdPrerelease: createPrerelease,
@@ -375,6 +376,7 @@ describe("Action", () => {
repo: "repo", repo: "repo",
tag: tag, tag: tag,
token: token, token: token,
updatedDraft: updateDraft,
updatedReleaseBody: updateBody, updatedReleaseBody: updateBody,
updatedReleaseName: updateName, updatedReleaseName: updateName,
updatedPrerelease: updatePrerelease updatedPrerelease: updatePrerelease

View File

@@ -108,7 +108,7 @@ describe('Inputs', () => {
it('returns input.artifacts with default contentType', () => { it('returns input.artifacts with default contentType', () => {
mockGetInput.mockReturnValueOnce('art1') mockGetInput.mockReturnValueOnce('art1')
.mockReturnValueOnce('raw') .mockReturnValueOnce('')
.mockReturnValueOnce('false') .mockReturnValueOnce('false')
expect(inputs.artifacts).toEqual(artifacts) expect(inputs.artifacts).toEqual(artifacts)
@@ -128,6 +128,17 @@ describe('Inputs', () => {
}) })
}) })
describe('createdDraft', () => {
it('returns false', () => {
expect(inputs.createdDraft).toBe(false)
})
it('returns true', () => {
mockGetInput.mockReturnValue('true')
expect(inputs.createdDraft).toBe(true)
})
})
describe('createdReleaseBody', () => { describe('createdReleaseBody', () => {
it('returns input body', () => { it('returns input body', () => {
mockGetInput mockGetInput
@@ -174,7 +185,7 @@ describe('Inputs', () => {
mockGetInput mockGetInput
.mockReturnValueOnce('true') .mockReturnValueOnce('true')
.mockReturnValueOnce('name') .mockReturnValueOnce('name')
expect(inputs.createdReleaseBody).toBeUndefined() expect(inputs.createdReleaseName).toBeUndefined()
}) })
it('returns tag', () => { it('returns tag', () => {
@@ -198,17 +209,6 @@ describe('Inputs', () => {
}) })
}) })
describe('draft', () => {
it('returns false', () => {
expect(inputs.draft).toBe(false)
})
it('returns true', () => {
mockGetInput.mockReturnValue('true')
expect(inputs.draft).toBe(true)
})
})
describe('generateReleaseNotes', () => { describe('generateReleaseNotes', () => {
it('returns returns true', function () { it('returns returns true', function () {
mockGetInput.mockReturnValue("true") mockGetInput.mockReturnValue("true")
@@ -299,6 +299,33 @@ describe('Inputs', () => {
}) })
}) })
describe('updatedDraft', () => {
it('returns false', () => {
expect(inputs.updatedDraft).toBe(false)
})
it('returns true', () => {
mockGetInput
.mockReturnValueOnce('false')
.mockReturnValue('true')
expect(inputs.updatedDraft).toBe(true)
})
it('returns true when omitted is blank', () => {
mockGetInput
.mockReturnValueOnce('')
.mockReturnValue('true')
expect(inputs.updatedDraft).toBe(true)
})
it('returns undefined when omitted for update', () => {
mockGetInput
.mockReturnValueOnce('true')
.mockReturnValueOnce('true')
expect(inputs.updatedDraft).toBeUndefined()
})
})
describe('updatedReleaseBody', () => { describe('updatedReleaseBody', () => {
it('returns input body', () => { it('returns input body', () => {
mockGetInput mockGetInput

View File

@@ -41,11 +41,11 @@ describe.skip('Integration Test', () => {
allowUpdates: true, allowUpdates: true,
artifactErrorsFailBuild: false, artifactErrorsFailBuild: false,
artifacts: artifacts(), artifacts: artifacts(),
createdDraft: false,
createdReleaseBody: "This release was generated by release-action's integration test", createdReleaseBody: "This release was generated by release-action's integration test",
createdReleaseName: "Releases Action Integration Test", createdReleaseName: "Releases Action Integration Test",
commit: undefined, commit: undefined,
discussionCategory: 'Release', discussionCategory: 'Release',
draft: false,
generateReleaseNotes: true, generateReleaseNotes: true,
owner: "ncipollo", owner: "ncipollo",
createdPrerelease: false, createdPrerelease: false,
@@ -54,6 +54,7 @@ describe.skip('Integration Test', () => {
repo: "actions-playground", repo: "actions-playground",
tag: "release-action-test", tag: "release-action-test",
token: getToken(), token: getToken(),
updatedDraft: false,
updatedReleaseBody: "This release was generated by release-action's integration test", updatedReleaseBody: "This release was generated by release-action's integration test",
updatedReleaseName: "Releases Action Integration Test", updatedReleaseName: "Releases Action Integration Test",
updatedPrerelease: false updatedPrerelease: false

View File

@@ -59,6 +59,10 @@ inputs:
description: 'Indicates if the release body should be omitted during updates. The body will still be applied for newly created releases. This will preserve the existing body during updates.' description: 'Indicates if the release body should be omitted during updates. The body will still be applied for newly created releases. This will preserve the existing body during updates.'
required: false required: false
default: 'false' default: 'false'
omitDraftDuringUpdate:
description: 'Indicates if the draft flag should be omitted during updates. The draft flag will still be applied for newly created releases. This will preserve the existing draft state during updates.'
required: false
default: 'false'
omitName: omitName:
description: 'Indicates if the release name should be omitted.' description: 'Indicates if the release name should be omitted.'
required: false required: false

76
dist/index.js vendored
View File

@@ -71,7 +71,7 @@ class Action {
} }
updateRelease(id) { updateRelease(id) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return yield this.releases.update(id, this.inputs.tag, this.inputs.updatedReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.draft, this.inputs.updatedReleaseName, this.inputs.updatedPrerelease); return yield this.releases.update(id, this.inputs.tag, this.inputs.updatedReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.updatedDraft, this.inputs.updatedReleaseName, this.inputs.updatedPrerelease);
}); });
} }
static noPublishedRelease(error) { static noPublishedRelease(error) {
@@ -100,7 +100,7 @@ class Action {
} }
createRelease() { createRelease() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return yield this.releases.create(this.inputs.tag, this.inputs.createdReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.draft, this.inputs.generateReleaseNotes, this.inputs.createdReleaseName, this.inputs.createdPrerelease); return yield this.releases.create(this.inputs.tag, this.inputs.createdReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.createdDraft, this.inputs.generateReleaseNotes, this.inputs.createdReleaseName, this.inputs.createdPrerelease);
}); });
} }
} }
@@ -640,14 +640,6 @@ class CoreInputs {
const allow = core.getInput('artifactErrorsFailBuild'); const allow = core.getInput('artifactErrorsFailBuild');
return allow == 'true'; return allow == 'true';
} }
get createdReleaseBody() {
if (CoreInputs.omitBody)
return undefined;
return this.body;
}
static get omitBody() {
return core.getInput('omitBody') == 'true';
}
get body() { get body() {
const body = core.getInput('body'); const body = core.getInput('body');
if (body) { if (body) {
@@ -659,6 +651,30 @@ class CoreInputs {
} }
return ''; return '';
} }
get createdDraft() {
const draft = core.getInput('draft');
return draft == 'true';
}
get createdPrerelease() {
const preRelease = core.getInput('prerelease');
return preRelease == 'true';
}
get createdReleaseBody() {
if (CoreInputs.omitBody)
return undefined;
return this.body;
}
static get omitBody() {
return core.getInput('omitBody') == 'true';
}
get createdReleaseName() {
if (CoreInputs.omitName)
return undefined;
return this.name;
}
static get omitName() {
return core.getInput('omitName') == 'true';
}
get commit() { get commit() {
const commit = core.getInput('commit'); const commit = core.getInput('commit');
if (commit) { if (commit) {
@@ -666,11 +682,6 @@ class CoreInputs {
} }
return undefined; return undefined;
} }
get createdReleaseName() {
if (CoreInputs.omitName)
return undefined;
return this.name;
}
get discussionCategory() { get discussionCategory() {
const category = core.getInput('discussionCategory'); const category = core.getInput('discussionCategory');
if (category) { if (category) {
@@ -678,9 +689,6 @@ class CoreInputs {
} }
return undefined; return undefined;
} }
static get omitName() {
return core.getInput('omitName') == 'true';
}
get name() { get name() {
const name = core.getInput('name'); const name = core.getInput('name');
if (name) { if (name) {
@@ -688,10 +696,6 @@ class CoreInputs {
} }
return this.tag; return this.tag;
} }
get draft() {
const draft = core.getInput('draft');
return draft == 'true';
}
get generateReleaseNotes() { get generateReleaseNotes() {
const generate = core.getInput('generateReleaseNotes'); const generate = core.getInput('generateReleaseNotes');
return generate == 'true'; return generate == 'true';
@@ -703,18 +707,6 @@ class CoreInputs {
} }
return this.context.repo.owner; return this.context.repo.owner;
} }
get createdPrerelease() {
const preRelease = core.getInput('prerelease');
return preRelease == 'true';
}
static get omitPrereleaseDuringUpdate() {
return core.getInput('omitPrereleaseDuringUpdate') == 'true';
}
get updatedPrerelease() {
if (CoreInputs.omitPrereleaseDuringUpdate)
return undefined;
return this.createdPrerelease;
}
get removeArtifacts() { get removeArtifacts() {
const removes = core.getInput('removeArtifacts'); const removes = core.getInput('removeArtifacts');
return removes == 'true'; return removes == 'true';
@@ -745,6 +737,22 @@ class CoreInputs {
get token() { get token() {
return core.getInput('token', { required: true }); return core.getInput('token', { required: true });
} }
get updatedDraft() {
if (CoreInputs.omitDraftDuringUpdate)
return undefined;
return this.createdDraft;
}
static get omitDraftDuringUpdate() {
return core.getInput('omitDraftDuringUpdate') == 'true';
}
get updatedPrerelease() {
if (CoreInputs.omitPrereleaseDuringUpdate)
return undefined;
return this.createdPrerelease;
}
static get omitPrereleaseDuringUpdate() {
return core.getInput('omitPrereleaseDuringUpdate') == 'true';
}
get updatedReleaseBody() { get updatedReleaseBody() {
if (CoreInputs.omitBody || CoreInputs.omitBodyDuringUpdate) if (CoreInputs.omitBody || CoreInputs.omitBodyDuringUpdate)
return undefined; return undefined;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -64,7 +64,7 @@ class Action {
} }
updateRelease(id) { updateRelease(id) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return yield this.releases.update(id, this.inputs.tag, this.inputs.updatedReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.draft, this.inputs.updatedReleaseName, this.inputs.updatedPrerelease); return yield this.releases.update(id, this.inputs.tag, this.inputs.updatedReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.updatedDraft, this.inputs.updatedReleaseName, this.inputs.updatedPrerelease);
}); });
} }
static noPublishedRelease(error) { static noPublishedRelease(error) {
@@ -93,7 +93,7 @@ class Action {
} }
createRelease() { createRelease() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return yield this.releases.create(this.inputs.tag, this.inputs.createdReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.draft, this.inputs.generateReleaseNotes, this.inputs.createdReleaseName, this.inputs.createdPrerelease); return yield this.releases.create(this.inputs.tag, this.inputs.createdReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.createdDraft, this.inputs.generateReleaseNotes, this.inputs.createdReleaseName, this.inputs.createdPrerelease);
}); });
} }
} }

View File

@@ -54,14 +54,6 @@ class CoreInputs {
const allow = core.getInput('artifactErrorsFailBuild'); const allow = core.getInput('artifactErrorsFailBuild');
return allow == 'true'; return allow == 'true';
} }
get createdReleaseBody() {
if (CoreInputs.omitBody)
return undefined;
return this.body;
}
static get omitBody() {
return core.getInput('omitBody') == 'true';
}
get body() { get body() {
const body = core.getInput('body'); const body = core.getInput('body');
if (body) { if (body) {
@@ -73,6 +65,30 @@ class CoreInputs {
} }
return ''; return '';
} }
get createdDraft() {
const draft = core.getInput('draft');
return draft == 'true';
}
get createdPrerelease() {
const preRelease = core.getInput('prerelease');
return preRelease == 'true';
}
get createdReleaseBody() {
if (CoreInputs.omitBody)
return undefined;
return this.body;
}
static get omitBody() {
return core.getInput('omitBody') == 'true';
}
get createdReleaseName() {
if (CoreInputs.omitName)
return undefined;
return this.name;
}
static get omitName() {
return core.getInput('omitName') == 'true';
}
get commit() { get commit() {
const commit = core.getInput('commit'); const commit = core.getInput('commit');
if (commit) { if (commit) {
@@ -80,11 +96,6 @@ class CoreInputs {
} }
return undefined; return undefined;
} }
get createdReleaseName() {
if (CoreInputs.omitName)
return undefined;
return this.name;
}
get discussionCategory() { get discussionCategory() {
const category = core.getInput('discussionCategory'); const category = core.getInput('discussionCategory');
if (category) { if (category) {
@@ -92,9 +103,6 @@ class CoreInputs {
} }
return undefined; return undefined;
} }
static get omitName() {
return core.getInput('omitName') == 'true';
}
get name() { get name() {
const name = core.getInput('name'); const name = core.getInput('name');
if (name) { if (name) {
@@ -102,10 +110,6 @@ class CoreInputs {
} }
return this.tag; return this.tag;
} }
get draft() {
const draft = core.getInput('draft');
return draft == 'true';
}
get generateReleaseNotes() { get generateReleaseNotes() {
const generate = core.getInput('generateReleaseNotes'); const generate = core.getInput('generateReleaseNotes');
return generate == 'true'; return generate == 'true';
@@ -117,18 +121,6 @@ class CoreInputs {
} }
return this.context.repo.owner; return this.context.repo.owner;
} }
get createdPrerelease() {
const preRelease = core.getInput('prerelease');
return preRelease == 'true';
}
static get omitPrereleaseDuringUpdate() {
return core.getInput('omitPrereleaseDuringUpdate') == 'true';
}
get updatedPrerelease() {
if (CoreInputs.omitPrereleaseDuringUpdate)
return undefined;
return this.createdPrerelease;
}
get removeArtifacts() { get removeArtifacts() {
const removes = core.getInput('removeArtifacts'); const removes = core.getInput('removeArtifacts');
return removes == 'true'; return removes == 'true';
@@ -159,6 +151,22 @@ class CoreInputs {
get token() { get token() {
return core.getInput('token', { required: true }); return core.getInput('token', { required: true });
} }
get updatedDraft() {
if (CoreInputs.omitDraftDuringUpdate)
return undefined;
return this.createdDraft;
}
static get omitDraftDuringUpdate() {
return core.getInput('omitDraftDuringUpdate') == 'true';
}
get updatedPrerelease() {
if (CoreInputs.omitPrereleaseDuringUpdate)
return undefined;
return this.createdPrerelease;
}
static get omitPrereleaseDuringUpdate() {
return core.getInput('omitPrereleaseDuringUpdate') == 'true';
}
get updatedReleaseBody() { get updatedReleaseBody() {
if (CoreInputs.omitBody || CoreInputs.omitBodyDuringUpdate) if (CoreInputs.omitBody || CoreInputs.omitBodyDuringUpdate)
return undefined; return undefined;

View File

@@ -7,6 +7,7 @@
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"clean": "rm -rf lib/*", "clean": "rm -rf lib/*",
"coverage": "jest --coverage",
"debug": "yarn clean && yarn install && yarn build && yarn package", "debug": "yarn clean && yarn install && yarn build && yarn package",
"package": "ncc build --source-map --license licenses.txt", "package": "ncc build --source-map --license licenses.txt",
"release": "yarn clean && yarn install --production && yarn build && yarn package", "release": "yarn clean && yarn install --production && yarn build && yarn package",

View File

@@ -78,7 +78,7 @@ export class Action {
this.inputs.updatedReleaseBody, this.inputs.updatedReleaseBody,
this.inputs.commit, this.inputs.commit,
this.inputs.discussionCategory, this.inputs.discussionCategory,
this.inputs.draft, this.inputs.updatedDraft,
this.inputs.updatedReleaseName, this.inputs.updatedReleaseName,
this.inputs.updatedPrerelease this.inputs.updatedPrerelease
) )
@@ -113,7 +113,7 @@ export class Action {
this.inputs.createdReleaseBody, this.inputs.createdReleaseBody,
this.inputs.commit, this.inputs.commit,
this.inputs.discussionCategory, this.inputs.discussionCategory,
this.inputs.draft, this.inputs.createdDraft,
this.inputs.generateReleaseNotes, this.inputs.generateReleaseNotes,
this.inputs.createdReleaseName, this.inputs.createdReleaseName,
this.inputs.createdPrerelease this.inputs.createdPrerelease

View File

@@ -9,18 +9,19 @@ export interface Inputs {
readonly artifactErrorsFailBuild: boolean readonly artifactErrorsFailBuild: boolean
readonly artifacts: Artifact[] readonly artifacts: Artifact[]
readonly commit?: string readonly commit?: string
readonly createdDraft: boolean
readonly createdPrerelease: boolean
readonly createdReleaseBody?: string readonly createdReleaseBody?: string
readonly createdReleaseName?: string readonly createdReleaseName?: string
readonly discussionCategory?: string readonly discussionCategory?: string
readonly draft: boolean
readonly generateReleaseNotes: boolean readonly generateReleaseNotes: boolean
readonly owner: string readonly owner: string
readonly createdPrerelease: boolean
readonly removeArtifacts: boolean readonly removeArtifacts: boolean
readonly replacesArtifacts: boolean readonly replacesArtifacts: boolean
readonly repo: string readonly repo: string
readonly tag: string readonly tag: string
readonly token: string readonly token: string
readonly updatedDraft?: boolean
readonly updatedReleaseBody?: string readonly updatedReleaseBody?: string
readonly updatedReleaseName?: string readonly updatedReleaseName?: string
readonly updatedPrerelease?: boolean readonly updatedPrerelease?: boolean
@@ -61,15 +62,6 @@ export class CoreInputs implements Inputs {
return allow == 'true' return allow == 'true'
} }
get createdReleaseBody(): string | undefined {
if (CoreInputs.omitBody) return undefined
return this.body
}
private static get omitBody(): boolean {
return core.getInput('omitBody') == 'true'
}
private get body(): string | undefined { private get body(): string | undefined {
const body = core.getInput('body') const body = core.getInput('body')
if (body) { if (body) {
@@ -84,6 +76,34 @@ export class CoreInputs implements Inputs {
return '' return ''
} }
get createdDraft(): boolean {
const draft = core.getInput('draft')
return draft == 'true'
}
get createdPrerelease(): boolean {
const preRelease = core.getInput('prerelease')
return preRelease == 'true'
}
get createdReleaseBody(): string | undefined {
if (CoreInputs.omitBody) return undefined
return this.body
}
private static get omitBody(): boolean {
return core.getInput('omitBody') == 'true'
}
get createdReleaseName(): string | undefined {
if (CoreInputs.omitName) return undefined
return this.name
}
private static get omitName(): boolean {
return core.getInput('omitName') == 'true'
}
get commit(): string | undefined { get commit(): string | undefined {
const commit = core.getInput('commit') const commit = core.getInput('commit')
if (commit) { if (commit) {
@@ -92,11 +112,6 @@ export class CoreInputs implements Inputs {
return undefined return undefined
} }
get createdReleaseName(): string | undefined {
if (CoreInputs.omitName) return undefined
return this.name
}
get discussionCategory(): string | undefined { get discussionCategory(): string | undefined {
const category = core.getInput('discussionCategory') const category = core.getInput('discussionCategory')
if (category) { if (category) {
@@ -105,10 +120,6 @@ export class CoreInputs implements Inputs {
return undefined return undefined
} }
private static get omitName(): boolean {
return core.getInput('omitName') == 'true'
}
private get name(): string | undefined { private get name(): string | undefined {
const name = core.getInput('name') const name = core.getInput('name')
if (name) { if (name) {
@@ -118,11 +129,6 @@ export class CoreInputs implements Inputs {
return this.tag return this.tag
} }
get draft(): boolean {
const draft = core.getInput('draft')
return draft == 'true'
}
get generateReleaseNotes(): boolean { get generateReleaseNotes(): boolean {
const generate = core.getInput('generateReleaseNotes') const generate = core.getInput('generateReleaseNotes')
return generate == 'true' return generate == 'true'
@@ -136,19 +142,6 @@ export class CoreInputs implements Inputs {
return this.context.repo.owner return this.context.repo.owner
} }
get createdPrerelease(): boolean {
const preRelease = core.getInput('prerelease')
return preRelease == 'true'
}
private static get omitPrereleaseDuringUpdate(): boolean {
return core.getInput('omitPrereleaseDuringUpdate') == 'true'
}
get updatedPrerelease(): boolean | undefined {
if (CoreInputs.omitPrereleaseDuringUpdate) return undefined
return this.createdPrerelease
}
get removeArtifacts(): boolean { get removeArtifacts(): boolean {
const removes = core.getInput('removeArtifacts') const removes = core.getInput('removeArtifacts')
return removes == 'true' return removes == 'true'
@@ -185,6 +178,24 @@ export class CoreInputs implements Inputs {
return core.getInput('token', {required: true}) return core.getInput('token', {required: true})
} }
get updatedDraft(): boolean | undefined {
if (CoreInputs.omitDraftDuringUpdate) return undefined
return this.createdDraft
}
private static get omitDraftDuringUpdate(): boolean {
return core.getInput('omitDraftDuringUpdate') == 'true'
}
get updatedPrerelease(): boolean | undefined {
if (CoreInputs.omitPrereleaseDuringUpdate) return undefined
return this.createdPrerelease
}
private static get omitPrereleaseDuringUpdate(): boolean {
return core.getInput('omitPrereleaseDuringUpdate') == 'true'
}
get updatedReleaseBody(): string | undefined { get updatedReleaseBody(): string | undefined {
if (CoreInputs.omitBody || CoreInputs.omitBodyDuringUpdate) return undefined if (CoreInputs.omitBody || CoreInputs.omitBodyDuringUpdate) return undefined
return this.body return this.body