Skip to content

Commit 9784b8b

Browse files
exclude merge commit when generating change log
1 parent 58724fd commit 9784b8b

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

dist/index.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ function generateReleaseNotes(branchDiffFile, projectKeys, previousVersion, newV
470470
console.log("Project keys: " + projectKeys);
471471
console.log("Lines: " + lines.length);
472472

473+
const mergeRegExp = new RegExp('Merge branch .* into .*');
474+
473475
const regExps = [];
474476
for (const projectKey of projectKeys) {
475477
regExps.push(new RegExp(`${projectKey.trim()}-([0-9]*)`))
@@ -478,14 +480,17 @@ function generateReleaseNotes(branchDiffFile, projectKeys, previousVersion, newV
478480
const tickets = {};
479481

480482
for (const line of lines) {
481-
const words = line.trim().split(" ");
483+
const mergeCommit = line.trim().match(mergeRegExp);
484+
if (!mergeCommit) {
485+
const words = line.trim().split(" ");
482486

483-
for (const word of words) {
484-
for (const re of regExps) {
485-
const r = word.trim().match(re);
487+
for (const word of words) {
488+
for (const re of regExps) {
489+
const r = word.trim().match(re);
486490

487-
if (r) {
488-
tickets[r[0]] = true;
491+
if (r) {
492+
tickets[r[0]] = true;
493+
}
489494
}
490495
}
491496
}

index.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ function generateReleaseNotes(branchDiffFile, projectKeys, previousVersion, newV
1010
console.log("Project keys: " + projectKeys);
1111
console.log("Lines: " + lines.length);
1212

13+
const mergeRegExp = new RegExp('Merge branch .* into .*');
14+
1315
const regExps = [];
1416
for (const projectKey of projectKeys) {
1517
regExps.push(new RegExp(`${projectKey.trim()}-([0-9]*)`))
@@ -18,14 +20,17 @@ function generateReleaseNotes(branchDiffFile, projectKeys, previousVersion, newV
1820
const tickets = {};
1921

2022
for (const line of lines) {
21-
const words = line.trim().split(" ");
23+
const mergeCommit = line.trim().match(mergeRegExp);
24+
if (!mergeCommit) {
25+
const words = line.trim().split(" ");
2226

23-
for (const word of words) {
24-
for (const re of regExps) {
25-
const r = word.trim().match(re);
27+
for (const word of words) {
28+
for (const re of regExps) {
29+
const r = word.trim().match(re);
2630

27-
if (r) {
28-
tickets[r[0]] = true;
31+
if (r) {
32+
tickets[r[0]] = true;
33+
}
2934
}
3035
}
3136
}

0 commit comments

Comments
 (0)