Skip to content

Commit

Permalink
exclude merge commit when generating change log
Browse files Browse the repository at this point in the history
  • Loading branch information
randilfernando committed Jul 9, 2021
1 parent 58724fd commit 9784b8b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
17 changes: 11 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ function generateReleaseNotes(branchDiffFile, projectKeys, previousVersion, newV
console.log("Project keys: " + projectKeys);
console.log("Lines: " + lines.length);

const mergeRegExp = new RegExp('Merge branch .* into .*');

const regExps = [];
for (const projectKey of projectKeys) {
regExps.push(new RegExp(`${projectKey.trim()}-([0-9]*)`))
Expand All @@ -478,14 +480,17 @@ function generateReleaseNotes(branchDiffFile, projectKeys, previousVersion, newV
const tickets = {};

for (const line of lines) {
const words = line.trim().split(" ");
const mergeCommit = line.trim().match(mergeRegExp);
if (!mergeCommit) {
const words = line.trim().split(" ");

for (const word of words) {
for (const re of regExps) {
const r = word.trim().match(re);
for (const word of words) {
for (const re of regExps) {
const r = word.trim().match(re);

if (r) {
tickets[r[0]] = true;
if (r) {
tickets[r[0]] = true;
}
}
}
}
Expand Down
17 changes: 11 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ function generateReleaseNotes(branchDiffFile, projectKeys, previousVersion, newV
console.log("Project keys: " + projectKeys);
console.log("Lines: " + lines.length);

const mergeRegExp = new RegExp('Merge branch .* into .*');

const regExps = [];
for (const projectKey of projectKeys) {
regExps.push(new RegExp(`${projectKey.trim()}-([0-9]*)`))
Expand All @@ -18,14 +20,17 @@ function generateReleaseNotes(branchDiffFile, projectKeys, previousVersion, newV
const tickets = {};

for (const line of lines) {
const words = line.trim().split(" ");
const mergeCommit = line.trim().match(mergeRegExp);
if (!mergeCommit) {
const words = line.trim().split(" ");

for (const word of words) {
for (const re of regExps) {
const r = word.trim().match(re);
for (const word of words) {
for (const re of regExps) {
const r = word.trim().match(re);

if (r) {
tickets[r[0]] = true;
if (r) {
tickets[r[0]] = true;
}
}
}
}
Expand Down

0 comments on commit 9784b8b

Please sign in to comment.