Skip to content

Commit

Permalink
Release notes include change type (Minor or Patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
randilfernando committed Jun 17, 2021
1 parent bb97b73 commit bfd85ba
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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`;
}
Expand Down
13 changes: 12 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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`;
}
Expand Down

0 comments on commit bfd85ba

Please sign in to comment.