Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc25c612

Browse files
committed
Create an option to ignore tags with Array of string
1 parent30f6194 commitc25c612

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

‎lib/_examples.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ module.exports = {
8282
description:'Create release notes for all the tags in the repository.',
8383
code:'gren release --tags=all'
8484
},
85+
{
86+
description:'Ignore the tags including an Array of strings',
87+
code:'gren release --tags=all --ignore-tags-with="-rc","-alpha","-beta"'
88+
},
8589
{
8690
name:'Work with milestones',
8791
description:'Create release notes for a tag using the belonging to a milestone that matches the name of the tag. e.g. If the tag is 4.0.0, `gren` is going to match the milestone _"Release 4.0.0"_.',

‎lib/_options.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,18 @@ module.exports = {
7878
action:/^(merge|commits|all)$/i,
7979
defaultValue:'commits'
8080
},
81+
{
82+
short:'-i',
83+
name:'ignore-tags-with',
84+
valueType:'<string1>,<string2>',
85+
description:'Ignore tags that contain one of the specified strings.',
86+
action:value=>value.split(',')
87+
},
8188
{
8289
short:'-C',
8390
name:'ignore-commits-with',
8491
valueType:'<string1>,<string2>',
85-
description:'Ignore commits thatcontains one of the specified strings.',
92+
description:'Ignore commits thatcontain one of the specified strings.',
8693
action:value=>value.split(',')
8794
},
8895
{

‎lib/src/Gren.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ class Gren {
3838
tags,
3939
ignoreLabels,
4040
ignoreIssuesWith,
41-
ignoreCommitsWith
41+
ignoreCommitsWith,
42+
ignoreTagsWith
4243
}=this.options;
4344

4445
this.options.tags=utils.convertStringToArray(tags);
4546
this.options.ignoreLabels=utils.convertStringToArray(ignoreLabels);
4647
this.options.ignoreIssuesWith=utils.convertStringToArray(ignoreIssuesWith);
4748
this.options.ignoreCommitsWith=utils.convertStringToArray(ignoreCommitsWith);
49+
this.options.ignoreTagsWith=utils.convertStringToArray(ignoreTagsWith);
4850
this.options.limit=this.options.tags.indexOf('all')>=0 ?MAX_TAGS_LIMIT :TAGS_LIMIT;
4951

5052
if(!token){
@@ -313,6 +315,7 @@ class Gren {
313315

314316
constfilteredTags=(this._getSelectedTags(tags)||[tags[0],tags[1]])
315317
.filter(Boolean)
318+
.filter(({ name})=>this.options.ignoreTagsWith.every(ignoreTag=>!name.match(ignoreTag)))
316319
.map(tag=>{
317320
consttagRelease=releases ?releases.filter(release=>release.tag_name===tag.name)[0] :false;
318321
constreleaseId=tagRelease ?tagRelease.id :null;

‎test/Gren.spec.js‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ describe('Gren', () => {
284284
});
285285

286286
describe('_getSelectedTags',()=>{
287-
// gren.options.tags = [2, 1];
288287
it('Should return all the tags',()=>{
289288
gren.options.tags='all';
290289
assert.deepEqual(gren._getSelectedTags(tags),tags,'The tags option is all');
@@ -546,6 +545,18 @@ describe('Gren', () => {
546545
.catch(err=>done(err));
547546
});
548547

548+
it('_getLastTags',done=>{
549+
gren.options.ignoreTagsWith=['11'];
550+
gren.options.tags=['0.12.0','0.11.0'];
551+
552+
gren._getLastTags()
553+
.then(tags=>{
554+
assert.notInclude(tags.map(({ name})=>name),'0.11.0','The ignored tag is not present');
555+
done();
556+
})
557+
.catch(err=>done(err));
558+
});
559+
549560
it('_getReleaseBlocks',done=>{
550561
gren._getReleaseBlocks()
551562
.then(releaseBlocks=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp