Update "makeLatest" so it's always defined

This commit is contained in:
Nick Cipollo
2022-12-11 13:56:37 -05:00
parent 78ea7b5528
commit a2e71bdd4e
6 changed files with 33 additions and 51 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ This action will create a GitHub release and optionally upload an artifact to it
## Action Inputs ## Action Inputs
| Input name | Description | Required | Default Value | | Input name | Description | Required | Default Value |
|----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------|----------------------| |----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------|----------------------|
| allowUpdates | An optional flag which indicates if we should update a release if it already exists. Defaults to false. | false | "" | | allowUpdates | An optional flag which indicates if we should update a release if it already exists. Defaults to false. | false | "" |
| artifactErrorsFailBuild | An optional flag which indicates if artifact read or upload errors should fail the build. | false | "" | | artifactErrorsFailBuild | An optional flag which indicates if artifact read or upload errors should fail the build. | false | "" |
| artifacts | An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma delimited list of paths (or globs) | false | "" | | artifacts | An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma delimited list of paths (or globs) | false | "" |
@@ -25,7 +25,7 @@ This action will create a GitHub release and optionally upload an artifact to it
| discussionCategory | When provided this will generate a discussion of the specified category. The category must exist otherwise this will cause the action to fail. This isn't used with draft releases | false | "" | | discussionCategory | When provided this will generate a discussion of the specified category. The category must exist otherwise this will cause the action to fail. This isn't used with draft releases | false | "" |
| draft | Optionally marks this release as a draft release. Set to true to enable. | false | "" | | draft | Optionally marks this release as a draft release. Set to true to enable. | false | "" |
| generateReleaseNotes | Indicates if release notes should be automatically generated. | false | false | | generateReleaseNotes | Indicates if release notes should be automatically generated. | false | false |
| makeLatest | Indicates if the release should be the "latest" release or not. release. | false | "legacy" | | makeLatest | Indicates if the release should be the "latest" release or not. | false | "legacy" |
| 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 |
-5
View File
@@ -240,11 +240,6 @@ describe('Inputs', () => {
mockGetInput.mockReturnValueOnce('true') mockGetInput.mockReturnValueOnce('true')
expect(inputs.makeLatest).toBe('true') expect(inputs.makeLatest).toBe('true')
}) })
it('returns undefined when omitted', () => {
mockGetInput.mockReturnValueOnce('')
expect(inputs.makeLatest).toBeUndefined()
})
}) })
describe('owner', () => { describe('owner', () => {
+1 -5
View File
@@ -780,11 +780,7 @@ class CoreInputs {
return generate == 'true'; return generate == 'true';
} }
get makeLatest() { get makeLatest() {
const makeLatest = core.getInput('makeLatest'); return core.getInput('makeLatest');
if (makeLatest) {
return makeLatest;
}
return undefined;
} }
get owner() { get owner() {
let owner = core.getInput('owner'); let owner = core.getInput('owner');
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -5
View File
@@ -115,11 +115,7 @@ class CoreInputs {
return generate == 'true'; return generate == 'true';
} }
get makeLatest() { get makeLatest() {
const makeLatest = core.getInput('makeLatest'); return core.getInput('makeLatest');
if (makeLatest) {
return makeLatest;
}
return undefined;
} }
get owner() { get owner() {
let owner = core.getInput('owner'); let owner = core.getInput('owner');
+2 -7
View File
@@ -137,13 +137,8 @@ export class CoreInputs implements Inputs {
return generate == 'true' return generate == 'true'
} }
get makeLatest(): string | undefined { get makeLatest(): string {
const makeLatest = core.getInput('makeLatest') return core.getInput('makeLatest')
if (makeLatest) {
return makeLatest
}
return undefined
} }
get owner(): string { get owner(): string {