Skip to content

Commit b1c2682

Browse files
committed
Fix commit inclusion in release ranges
1 parent 2460fac commit b1c2682

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ rules:
5656
prefer-rest-params: error
5757
prefer-promise-reject-errors: 0
5858
valid-typeof: 0
59+
overrides:
60+
files:
61+
- "*.spec.js"
62+
env:
63+
mocha: true

lib/src/Gren.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -652,10 +652,10 @@ class Gren {
652652
*
653653
* @return {string}
654654
*/
655-
_generateCommitsBody(commits = []) {
655+
_generateCommitsBody(commits = [], addEmptyCommit) {
656656
const bodyMessages = Array.from(commits);
657657

658-
if (bodyMessages.length === 1) {
658+
if (bodyMessages.length === 1 || addEmptyCommit) {
659659
bodyMessages.push(null);
660660
}
661661

@@ -716,7 +716,7 @@ class Gren {
716716
name: this.options.prefix + range[0].name,
717717
release: range[0].name,
718718
published_at: range[0].date,
719-
body: this._generateCommitsBody(commits) + '\n'
719+
body: this._generateCommitsBody(commits, range[1].id === 0) + '\n'
720720
};
721721
})
722722
);
@@ -1091,8 +1091,7 @@ class Gren {
10911091
}
10921092

10931093
for (let i = 0; i < sortedReleaseDates.length - 1; i++) {
1094-
// NOTE: Get one second later
1095-
const until = (new Date(new Date(sortedReleaseDates[i + 1].date).getTime() + 1000).toISOString()).replace(/\.000Z$/, 'Z');
1094+
const until = sortedReleaseDates[i + 1].date;
10961095
ranges.push([
10971096
sortedReleaseDates[i],
10981097
{

test/Gren.spec.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const TOKEN = process.env.GREN_GITHUB_TOKEN;
88

99
if (!TOKEN) {
1010
console.log(chalk.blue('Token not present, skipping Gren tests.'));
11+
// eslint-disable-next-line no-global-assign
1112
describe = describe.skip;
1213
}
1314

@@ -78,23 +79,23 @@ describe('Gren', () => {
7879
date: '2017-10-01T23:00:00.000Z'
7980
},
8081
{
81-
date: '2017-09-01T23:00:01Z'
82+
date: '2017-09-01T23:00:00.000Z'
8283
}
8384
],
8485
[
8586
{
8687
date: '2017-09-01T23:00:00.000Z'
8788
},
8889
{
89-
date: '2017-05-01T23:00:01Z'
90+
date: '2017-05-01T23:00:00.000Z'
9091
}
9192
],
9293
[
9394
{
9495
date: '2017-05-01T23:00:00.000Z'
9596
},
9697
{
97-
date: '2016-09-01T23:00:01Z'
98+
date: '2016-09-01T23:00:00.000Z'
9899
}
99100
]
100101
];
@@ -108,7 +109,7 @@ describe('Gren', () => {
108109
},
109110
{
110111
id: 0,
111-
date: '1970-01-01T00:00:01Z'
112+
date: new Date('1970-01-01T00:00:00.000Z')
112113
}
113114
]]), 'Given release blocks with all tags option in');
114115
});

0 commit comments

Comments
 (0)