diff --git a/dist/index.js b/dist/index.js index 7a45a9c..7ed133d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -468,8 +468,13 @@ function generateReleaseNotes(branchDiffFile, projectKey, createReleaseUrl) { const re = new RegExp(`${projectKey}-([0-9]*)`); const tickets = {}; + let isFeatureChange = false; for (const line of lines) { + if (line.includes('[FEATURE]')) { + isFeatureChange = true; + } + const words = line.trim().split(" "); for (const word of words) { @@ -484,8 +489,14 @@ function generateReleaseNotes(branchDiffFile, projectKey, createReleaseUrl) { const ticketIds = Object.keys(tickets); console.log("Detected tickets: " + JSON.stringify(ticketIds)); - let releaseNotes = "## Changes\n"; + let releaseNotes = "## Change type\n"; + if (isFeatureChange) { + releaseNotes += "**Minor** change\n" + } else{ + releaseNotes += "**Patch** change\n" + } + releaseNotes += "## Changes\n"; for (const ticketId of ticketIds) { releaseNotes += `- ${ticketId}\n`; } diff --git a/index.js b/index.js index 7549586..bdf0bad 100644 --- a/index.js +++ b/index.js @@ -8,8 +8,13 @@ function generateReleaseNotes(branchDiffFile, projectKey, createReleaseUrl) { const re = new RegExp(`${projectKey}-([0-9]*)`); const tickets = {}; + let isFeatureChange = false; for (const line of lines) { + if (line.includes('[FEATURE]')) { + isFeatureChange = true; + } + const words = line.trim().split(" "); for (const word of words) { @@ -24,8 +29,14 @@ function generateReleaseNotes(branchDiffFile, projectKey, createReleaseUrl) { const ticketIds = Object.keys(tickets); console.log("Detected tickets: " + JSON.stringify(ticketIds)); - let releaseNotes = "## Changes\n"; + let releaseNotes = "## Change type\n"; + if (isFeatureChange) { + releaseNotes += "**Minor** change\n" + } else{ + releaseNotes += "**Patch** change\n" + } + releaseNotes += "## Changes\n"; for (const ticketId of ticketIds) { releaseNotes += `- ${ticketId}\n`; }