Skip to content

Commit fa47493

Browse files
authored
Fixes #513 Don't generate release notes if omitBody is set (#517)
1 parent 36e78ab commit fa47493

File tree

7 files changed

+219
-80
lines changed

7 files changed

+219
-80
lines changed

__tests__/Action.test.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,34 @@ describe("Action", () => {
389389
assertOutputApplied()
390390
})
391391

392+
it("updates release with static body when generateReleaseNotes is true but omitBodyDuringUpdate is true", async () => {
393+
const action = createAction(true, true, false, true, true)
394+
const error = { status: 404 }
395+
getMock.mockRejectedValue(error)
396+
listMock.mockResolvedValue({
397+
data: [
398+
{ id: 123, draft: false, tag_name: tag },
399+
{ id: id, draft: true, tag_name: tag },
400+
],
401+
})
402+
403+
await action.perform()
404+
405+
expect(updateMock).toHaveBeenCalledWith(
406+
id,
407+
tag,
408+
updateBody,
409+
commit,
410+
discussionCategory,
411+
updateDraft,
412+
makeLatest,
413+
updateName,
414+
updatePrerelease
415+
)
416+
expect(uploadMock).toHaveBeenCalledWith(artifacts, releaseId, url)
417+
assertOutputApplied()
418+
})
419+
392420
function assertOutputApplied() {
393421
expect(applyReleaseDataMock).toHaveBeenCalledWith({
394422
id: releaseId,
@@ -400,7 +428,8 @@ describe("Action", () => {
400428
allowUpdates: boolean,
401429
hasArtifact: boolean,
402430
removeArtifacts = false,
403-
generateReleaseNotes = true
431+
generateReleaseNotes = true,
432+
omitBodyDuringUpdate = false
404433
): Action {
405434
let inputArtifact: Artifact[]
406435

@@ -477,6 +506,7 @@ describe("Action", () => {
477506
updatedReleaseName: updateName,
478507
updatedPrerelease: updatePrerelease,
479508
updateOnlyUnreleased: updateOnlyUnreleased,
509+
omitBodyDuringUpdate,
480510
}
481511
})
482512
const MockOutputs = jest.fn<Outputs, any>(() => {

__tests__/Inputs.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,17 @@ describe("Inputs", () => {
421421
})
422422
})
423423

424+
describe("omitBodyDuringUpdate", () => {
425+
it("returns false", () => {
426+
expect(inputs.omitBodyDuringUpdate).toBe(false)
427+
})
428+
429+
it("returns true", () => {
430+
mockGetInput.mockReturnValueOnce("true")
431+
expect(inputs.omitBodyDuringUpdate).toBe(true)
432+
})
433+
})
434+
424435
function createGlobber(): ArtifactGlobber {
425436
const MockGlobber = jest.fn<ArtifactGlobber, any>(() => {
426437
return {

__tests__/Integration.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ describe.skip("Integration Test", () => {
4545
commit: undefined,
4646
discussionCategory: "Release",
4747
generateReleaseNotes: true,
48+
omitBodyDuringUpdate: false,
4849
owner: "ncipollo",
4950
createdPrerelease: false,
5051
replacesArtifacts: true,

0 commit comments

Comments
 (0)