Standardize on separate call to generate release notes
This commit is contained in:
@@ -55,6 +55,7 @@ describe("Action", () => {
|
|||||||
applyReleaseDataMock.mockClear()
|
applyReleaseDataMock.mockClear()
|
||||||
applyAssetUrlsMock.mockClear()
|
applyAssetUrlsMock.mockClear()
|
||||||
createMock.mockClear()
|
createMock.mockClear()
|
||||||
|
genReleaseNotesMock.mockClear()
|
||||||
getMock.mockClear()
|
getMock.mockClear()
|
||||||
listMock.mockClear()
|
listMock.mockClear()
|
||||||
shouldSkipMock.mockClear()
|
shouldSkipMock.mockClear()
|
||||||
@@ -62,18 +63,81 @@ describe("Action", () => {
|
|||||||
uploadMock.mockClear()
|
uploadMock.mockClear()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("creates release with generated release notes when no body provided", async () => {
|
||||||
|
const action = createAction(false, false, false, true, false, "")
|
||||||
|
|
||||||
|
await action.perform()
|
||||||
|
|
||||||
|
expect(genReleaseNotesMock).toHaveBeenCalledWith(tag)
|
||||||
|
expect(createMock).toHaveBeenCalledWith(
|
||||||
|
tag,
|
||||||
|
generatedReleaseBody,
|
||||||
|
commit,
|
||||||
|
discussionCategory,
|
||||||
|
createDraft,
|
||||||
|
makeLatest,
|
||||||
|
createName,
|
||||||
|
createPrerelease
|
||||||
|
)
|
||||||
|
expect(uploadMock).not.toHaveBeenCalled()
|
||||||
|
assertOutputApplied()
|
||||||
|
assertAssetUrlsApplied({})
|
||||||
|
})
|
||||||
|
|
||||||
|
it("creates release with generated release notes that override existing body", async () => {
|
||||||
|
const action = createAction(false, false, false, true, false, "existing body")
|
||||||
|
|
||||||
|
await action.perform()
|
||||||
|
|
||||||
|
expect(genReleaseNotesMock).toHaveBeenCalledWith(tag)
|
||||||
|
expect(createMock).toHaveBeenCalledWith(
|
||||||
|
tag,
|
||||||
|
generatedReleaseBody,
|
||||||
|
commit,
|
||||||
|
discussionCategory,
|
||||||
|
createDraft,
|
||||||
|
makeLatest,
|
||||||
|
createName,
|
||||||
|
createPrerelease
|
||||||
|
)
|
||||||
|
expect(uploadMock).not.toHaveBeenCalled()
|
||||||
|
assertOutputApplied()
|
||||||
|
assertAssetUrlsApplied({})
|
||||||
|
})
|
||||||
|
|
||||||
|
it("creates release with static body when generateReleaseNotes is false", async () => {
|
||||||
|
const action = createAction(false, false, false, false, false, "static body")
|
||||||
|
|
||||||
|
await action.perform()
|
||||||
|
|
||||||
|
expect(genReleaseNotesMock).not.toHaveBeenCalled()
|
||||||
|
expect(createMock).toHaveBeenCalledWith(
|
||||||
|
tag,
|
||||||
|
"static body",
|
||||||
|
commit,
|
||||||
|
discussionCategory,
|
||||||
|
createDraft,
|
||||||
|
makeLatest,
|
||||||
|
createName,
|
||||||
|
createPrerelease
|
||||||
|
)
|
||||||
|
expect(uploadMock).not.toHaveBeenCalled()
|
||||||
|
assertOutputApplied()
|
||||||
|
assertAssetUrlsApplied({})
|
||||||
|
})
|
||||||
|
|
||||||
it("creates release but does not upload if no artifact", async () => {
|
it("creates release but does not upload if no artifact", async () => {
|
||||||
const action = createAction(false, false)
|
const action = createAction(false, false)
|
||||||
|
|
||||||
await action.perform()
|
await action.perform()
|
||||||
|
|
||||||
|
expect(genReleaseNotesMock).toHaveBeenCalledWith(tag)
|
||||||
expect(createMock).toHaveBeenCalledWith(
|
expect(createMock).toHaveBeenCalledWith(
|
||||||
tag,
|
tag,
|
||||||
createBody,
|
generatedReleaseBody,
|
||||||
commit,
|
commit,
|
||||||
discussionCategory,
|
discussionCategory,
|
||||||
createDraft,
|
createDraft,
|
||||||
generateReleaseNotes,
|
|
||||||
makeLatest,
|
makeLatest,
|
||||||
createName,
|
createName,
|
||||||
createPrerelease
|
createPrerelease
|
||||||
@@ -90,13 +154,13 @@ describe("Action", () => {
|
|||||||
|
|
||||||
await action.perform()
|
await action.perform()
|
||||||
|
|
||||||
|
expect(genReleaseNotesMock).toHaveBeenCalledWith(tag)
|
||||||
expect(createMock).toHaveBeenCalledWith(
|
expect(createMock).toHaveBeenCalledWith(
|
||||||
tag,
|
tag,
|
||||||
createBody,
|
generatedReleaseBody,
|
||||||
commit,
|
commit,
|
||||||
discussionCategory,
|
discussionCategory,
|
||||||
createDraft,
|
createDraft,
|
||||||
generateReleaseNotes,
|
|
||||||
makeLatest,
|
makeLatest,
|
||||||
createName,
|
createName,
|
||||||
createPrerelease
|
createPrerelease
|
||||||
@@ -119,13 +183,13 @@ describe("Action", () => {
|
|||||||
|
|
||||||
await action.perform()
|
await action.perform()
|
||||||
|
|
||||||
|
expect(genReleaseNotesMock).toHaveBeenCalledWith(tag)
|
||||||
expect(createMock).toHaveBeenCalledWith(
|
expect(createMock).toHaveBeenCalledWith(
|
||||||
tag,
|
tag,
|
||||||
createBody,
|
generatedReleaseBody,
|
||||||
commit,
|
commit,
|
||||||
discussionCategory,
|
discussionCategory,
|
||||||
createDraft,
|
createDraft,
|
||||||
generateReleaseNotes,
|
|
||||||
makeLatest,
|
makeLatest,
|
||||||
createName,
|
createName,
|
||||||
createPrerelease
|
createPrerelease
|
||||||
@@ -143,13 +207,13 @@ describe("Action", () => {
|
|||||||
|
|
||||||
await action.perform()
|
await action.perform()
|
||||||
|
|
||||||
|
expect(genReleaseNotesMock).toHaveBeenCalledWith(tag)
|
||||||
expect(createMock).toHaveBeenCalledWith(
|
expect(createMock).toHaveBeenCalledWith(
|
||||||
tag,
|
tag,
|
||||||
createBody,
|
generatedReleaseBody,
|
||||||
commit,
|
commit,
|
||||||
discussionCategory,
|
discussionCategory,
|
||||||
createDraft,
|
createDraft,
|
||||||
generateReleaseNotes,
|
|
||||||
makeLatest,
|
makeLatest,
|
||||||
createName,
|
createName,
|
||||||
createPrerelease
|
createPrerelease
|
||||||
@@ -209,13 +273,13 @@ describe("Action", () => {
|
|||||||
expect(error).toEqual("error")
|
expect(error).toEqual("error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expect(genReleaseNotesMock).toHaveBeenCalledWith(tag)
|
||||||
expect(createMock).toHaveBeenCalledWith(
|
expect(createMock).toHaveBeenCalledWith(
|
||||||
tag,
|
tag,
|
||||||
createBody,
|
generatedReleaseBody,
|
||||||
commit,
|
commit,
|
||||||
discussionCategory,
|
discussionCategory,
|
||||||
createDraft,
|
createDraft,
|
||||||
generateReleaseNotes,
|
|
||||||
makeLatest,
|
makeLatest,
|
||||||
createName,
|
createName,
|
||||||
createPrerelease
|
createPrerelease
|
||||||
@@ -310,13 +374,13 @@ describe("Action", () => {
|
|||||||
expect(error).toEqual(expectedError)
|
expect(error).toEqual(expectedError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expect(genReleaseNotesMock).toHaveBeenCalledWith(tag)
|
||||||
expect(createMock).toHaveBeenCalledWith(
|
expect(createMock).toHaveBeenCalledWith(
|
||||||
tag,
|
tag,
|
||||||
createBody,
|
generatedReleaseBody,
|
||||||
commit,
|
commit,
|
||||||
discussionCategory,
|
discussionCategory,
|
||||||
createDraft,
|
createDraft,
|
||||||
generateReleaseNotes,
|
|
||||||
makeLatest,
|
makeLatest,
|
||||||
createName,
|
createName,
|
||||||
createPrerelease
|
createPrerelease
|
||||||
@@ -484,7 +548,8 @@ describe("Action", () => {
|
|||||||
hasArtifact: boolean,
|
hasArtifact: boolean,
|
||||||
removeArtifacts = false,
|
removeArtifacts = false,
|
||||||
generateReleaseNotes = true,
|
generateReleaseNotes = true,
|
||||||
omitBodyDuringUpdate = false
|
omitBodyDuringUpdate = false,
|
||||||
|
createdReleaseBody = createBody
|
||||||
): Action {
|
): Action {
|
||||||
let inputArtifact: Artifact[]
|
let inputArtifact: Artifact[]
|
||||||
|
|
||||||
@@ -551,7 +616,7 @@ describe("Action", () => {
|
|||||||
artifactErrorsFailBuild: true,
|
artifactErrorsFailBuild: true,
|
||||||
artifacts: inputArtifact,
|
artifacts: inputArtifact,
|
||||||
createdDraft: createDraft,
|
createdDraft: createDraft,
|
||||||
createdReleaseBody: createBody,
|
createdReleaseBody: createdReleaseBody,
|
||||||
createdReleaseName: createName,
|
createdReleaseName: createName,
|
||||||
commit,
|
commit,
|
||||||
discussionCategory,
|
discussionCategory,
|
||||||
|
|||||||
1910
dist/index.js
vendored
1910
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
104
dist/licenses.txt
vendored
104
dist/licenses.txt
vendored
@@ -93,6 +93,60 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
IN THE SOFTWARE.
|
IN THE SOFTWARE.
|
||||||
|
|
||||||
|
@isaacs/balanced-match
|
||||||
|
MIT
|
||||||
|
(MIT)
|
||||||
|
|
||||||
|
Original code Copyright Julian Gruber <julian@juliangruber.com>
|
||||||
|
|
||||||
|
Port to TypeScript Copyright Isaac Z. Schlueter <i@izs.me>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
@isaacs/brace-expansion
|
||||||
|
MIT
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright Julian Gruber <julian@juliangruber.com>
|
||||||
|
|
||||||
|
TypeScript port Copyright Isaac Z. Schlueter <i@izs.me>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
@octokit/auth-token
|
@octokit/auth-token
|
||||||
MIT
|
MIT
|
||||||
The MIT License
|
The MIT License
|
||||||
@@ -265,31 +319,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
balanced-match
|
|
||||||
MIT
|
|
||||||
(MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
before-after-hook
|
before-after-hook
|
||||||
Apache-2.0
|
Apache-2.0
|
||||||
Apache License
|
Apache License
|
||||||
@@ -495,31 +524,6 @@ Apache-2.0
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
brace-expansion
|
|
||||||
MIT
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
deprecation
|
deprecation
|
||||||
ISC
|
ISC
|
||||||
The ISC License
|
The ISC License
|
||||||
|
|||||||
@@ -141,13 +141,19 @@ export class Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async createRelease(): Promise<CreateReleaseResponse> {
|
private async createRelease(): Promise<CreateReleaseResponse> {
|
||||||
|
let releaseBody = this.inputs.createdReleaseBody
|
||||||
|
|
||||||
|
if (this.inputs.generateReleaseNotes) {
|
||||||
|
const response = await this.releases.generateReleaseNotes(this.inputs.tag)
|
||||||
|
releaseBody = response.data.body
|
||||||
|
}
|
||||||
|
|
||||||
return await this.releases.create(
|
return await this.releases.create(
|
||||||
this.inputs.tag,
|
this.inputs.tag,
|
||||||
this.inputs.createdReleaseBody,
|
releaseBody,
|
||||||
this.inputs.commit,
|
this.inputs.commit,
|
||||||
this.inputs.discussionCategory,
|
this.inputs.discussionCategory,
|
||||||
this.inputs.createdDraft,
|
this.inputs.createdDraft,
|
||||||
this.inputs.generateReleaseNotes,
|
|
||||||
this.inputs.makeLatest,
|
this.inputs.makeLatest,
|
||||||
this.inputs.createdReleaseName,
|
this.inputs.createdReleaseName,
|
||||||
this.inputs.createdPrerelease
|
this.inputs.createdPrerelease
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ export interface Releases {
|
|||||||
commitHash?: string,
|
commitHash?: string,
|
||||||
discussionCategory?: string,
|
discussionCategory?: string,
|
||||||
draft?: boolean,
|
draft?: boolean,
|
||||||
generateReleaseNotes?: boolean,
|
|
||||||
makeLatest?: "legacy" | "true" | "false" | undefined,
|
makeLatest?: "legacy" | "true" | "false" | undefined,
|
||||||
name?: string,
|
name?: string,
|
||||||
prerelease?: boolean
|
prerelease?: boolean
|
||||||
@@ -80,7 +79,6 @@ export class GithubReleases implements Releases {
|
|||||||
commitHash?: string,
|
commitHash?: string,
|
||||||
discussionCategory?: string,
|
discussionCategory?: string,
|
||||||
draft?: boolean,
|
draft?: boolean,
|
||||||
generateReleaseNotes?: boolean,
|
|
||||||
makeLatest?: "legacy" | "true" | "false" | undefined,
|
makeLatest?: "legacy" | "true" | "false" | undefined,
|
||||||
name?: string,
|
name?: string,
|
||||||
prerelease?: boolean
|
prerelease?: boolean
|
||||||
@@ -91,7 +89,6 @@ export class GithubReleases implements Releases {
|
|||||||
name: name,
|
name: name,
|
||||||
discussion_category_name: discussionCategory,
|
discussion_category_name: discussionCategory,
|
||||||
draft: draft,
|
draft: draft,
|
||||||
generate_release_notes: generateReleaseNotes,
|
|
||||||
make_latest: makeLatest,
|
make_latest: makeLatest,
|
||||||
owner: this.inputs.owner,
|
owner: this.inputs.owner,
|
||||||
prerelease: prerelease,
|
prerelease: prerelease,
|
||||||
|
|||||||
Reference in New Issue
Block a user