11# issue-parser
22
3- Parser for Github, GitLab and Bitbucket issues actions, references and mentions
3+ Parser for [ Github] ( https://github.com ) , [ GitLab] ( https://gitlab.com ) , [ Bitbucket ] ( https://bitbucket.org ) and [ Waffle ] ( https://waffle.io ) issues actions, references and mentions
44
55[ ![ Travis] ( https://img.shields.io/travis/pvdlg/issue-parser.svg )] ( https://travis-ci.org/pvdlg/issue-parser )
66[ ![ Codecov] ( https://img.shields.io/codecov/c/github/pvdlg/issue-parser.svg )] ( https://codecov.io/gh/pvdlg/issue-parser )
@@ -10,6 +10,7 @@ The parser can identify:
1010- GitHub [ closing keywords] ( https://help.github.com/articles/closing-issues-using-keywords ) , [ duplicate keyword] ( https://help.github.com/articles/about-duplicate-issues-and-pull-requests ) , [ issue references] ( https://guides.github.com/features/issues/#notifications ) and [ user mentions] ( https://guides.github.com/features/issues/#notifications )
1111- GitLab [ closing keywords] ( https://docs.gitlab.com/ee/user/project/issues/automatic_issue_closing.html ) , [ duplicate keyword] ( https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12845 ) , [ issue references] ( https://about.gitlab.com/2016/03/08/gitlab-tutorial-its-all-connected ) and [ user mentions] ( https://about.gitlab.com/2016/03/08/gitlab-tutorial-its-all-connected )
1212- Bitbucket [ closing keywords] ( https://confluence.atlassian.com/bitbucket/resolve-issues-automatically-when-users-push-code-221451126.html ) , [ issue references] ( https://confluence.atlassian.com/bitbucket/mark-up-comments-issues-and-commit-messages-321859781.html ) and [ user mentions] ( https://confluence.atlassian.com/bitbucket/mark-up-comments-issues-and-commit-messages-321859781.html )
13+ - Waffle.io [ epics] ( https://help.waffle.io/epics/which-keywords-are-supported-with-epics ) and [ dependencies] ( https://help.waffle.io/dependencies/which-keywords-are-supported-with-dependencies ) keywords
1314
1415## Install
1516
@@ -67,7 +68,26 @@ parse('Issue description, ref user/package#1, fixing #2. /cc @user');
6768{
6869 refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}],
6970 actions: [{raw: 'fixing #2', action: 'Fixing', prefix: '#', issue: '2'}],
70- duplicates: [],
71+ mentions: [{raw: '@user', prefix: '@', user: 'user'}],
72+ }
73+ */
74+ ```
75+
76+ ### Waffle format
77+
78+ ``` js
79+ const issueParser = require (' issue-parser' );
80+ const parse = issueParser (' waffle' );
81+
82+ parse (' Issue description, ref user/package#1, Fix #2, blocks user/package#3, Require #4, Parent of #5, Child of #6 /cc @user' );
83+ /*
84+ {
85+ refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}],
86+ actions: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}],
87+ blocks: [{raw: 'blocks user/package#3', action: 'Blocks', slug: 'user/package', prefix: '#', issue: '3'}],
88+ requires: [{raw: 'Require #4', action: 'Require', prefix: '#', issue: '4'}],
89+ parentOf: [{raw: 'Parent of #5', action: 'Parent of', prefix: '#', issue: '5'}],
90+ childOf: [{raw: 'Child of #6', action: 'Child of', prefix: '#', issue: '6'}],
7191 mentions: [{raw: '@user', prefix: '@', user: 'user'}],
7292}
7393*/
@@ -77,15 +97,14 @@ parse('Issue description, ref user/package#1, fixing #2. /cc @user');
7797
7898``` js
7999const issueParser = require (' issue-parser' );
80- const parse = issueParser ({referenceActions: [' complete' ], issuePrefixes: [' 🐛' ]});
100+ const parse = issueParser ({referenceActions: [' complete' ], blocksActions : [ ' holds up ' ], issuePrefixes: [' 🐛' ]});
81101
82- parse (' Issue description, related to user/package🐛1, Complete 🐛2' );
102+ parse (' Issue description, related to user/package🐛1, Complete 🐛2, holds up 🐛3 ' );
83103/*
84104{
85105 refs: [{raw: 'user/package🐛1', slug: 'user/package', prefix: '🐛', issue: '1'}],
86106 actions: [{raw: 'Complete 🐛2', action: 'Complete', prefix: '🐛', issue: '2'}],
87- duplicates: [],
88- mentions: [],
107+ blocks: [{raw: 'holds up 🐛3', action: 'Holds up', prefix: '🐛', issue: '3'}],
89108}
90109*/
91110```
@@ -282,6 +301,34 @@ Default: `['close', 'closes', 'closed', 'closing', 'fix', 'fixes', 'fixed', 'fix
282301
283302List of action keywords used to close issues and pull requests.
284303
304+ ##### blocksActions
305+
306+ Type: ` Array<String> ` ` String ` <br >
307+ Default: ` ['blocks', 'block', 'required by', 'needed by', 'dependency of'] `
308+
309+ List of action keywords used to make an issue or pull request block another one.
310+
311+ ##### requiresActions
312+
313+ Type: ` Array<String> ` ` String ` <br >
314+ Default: ` ['blocked by', 'requires', 'require', 'need', 'needs', 'depends on'] `
315+
316+ List of action keywords used to make an issue or pull request blocked by another one.
317+
318+ ##### parentOfActions
319+
320+ Type: ` Array<String> ` ` String ` <br >
321+ Default: ` ['parent of', 'parent to', 'parent'] `
322+
323+ List of action keywords used to make an issue or pull request the parent of another one.
324+
325+ ##### childOfActions
326+
327+ Type: ` Array<String> ` ` String ` <br >
328+ Default: ` ['child of', 'child to', 'child'] `
329+
330+ List of action keywords used to make an issue or pull request the child of another one.
331+
285332##### duplicateActions
286333
287334Type: ` Array<String> ` ` String ` <br >
@@ -355,6 +402,66 @@ Each action has the following properties:
355402| prefix | ` String ` | The prefix used to identify the issue. |
356403| issue | ` String ` | The issue number. |
357404
405+ #### blocks
406+
407+ Type: ` Array<Object> `
408+
409+ List of issues and pull requests blocked.<br >
410+ Each action has the following properties:
411+
412+ | Name | Type | Description |
413+ | --------| ----------| ---------------------------------------------------------------------------------------|
414+ | raw | ` String ` | The raw value parsed, for example ` Blocks #1 ` . |
415+ | action | ` String ` | The keyword used to identify the action, capitalized. |
416+ | slug | ` String ` | The repository owner and name, for issue referred as ` <owner>/<repo>#<issue number> ` . |
417+ | prefix | ` String ` | The prefix used to identify the issue. |
418+ | issue | ` String ` | The issue number. |
419+
420+ #### requires
421+
422+ Type: ` Array<Object> `
423+
424+ List of issues and pull requests required.<br >
425+ Each action has the following properties:
426+
427+ | Name | Type | Description |
428+ | --------| ----------| ---------------------------------------------------------------------------------------|
429+ | raw | ` String ` | The raw value parsed, for example ` Requires #1 ` . |
430+ | action | ` String ` | The keyword used to identify the action, capitalized. |
431+ | slug | ` String ` | The repository owner and name, for issue referred as ` <owner>/<repo>#<issue number> ` . |
432+ | prefix | ` String ` | The prefix used to identify the issue. |
433+ | issue | ` String ` | The issue number. |
434+
435+ #### parentOf
436+
437+ Type: ` Array<Object> `
438+
439+ List of child issues and pull requests.<br >
440+ Each action has the following properties:
441+
442+ | Name | Type | Description |
443+ | --------| ----------| ---------------------------------------------------------------------------------------|
444+ | raw | ` String ` | The raw value parsed, for example ` Parent of #1 ` . |
445+ | action | ` String ` | The keyword used to identify the action, capitalized. |
446+ | slug | ` String ` | The repository owner and name, for issue referred as ` <owner>/<repo>#<issue number> ` . |
447+ | prefix | ` String ` | The prefix used to identify the issue. |
448+ | issue | ` String ` | The issue number. |
449+
450+ #### childOf
451+
452+ Type: ` Array<Object> `
453+
454+ List of parent issues and pull requests.<br >
455+ Each action has the following properties:
456+
457+ | Name | Type | Description |
458+ | --------| ----------| ---------------------------------------------------------------------------------------|
459+ | raw | ` String ` | The raw value parsed, for example ` Child of #1 ` . |
460+ | action | ` String ` | The keyword used to identify the action, capitalized. |
461+ | slug | ` String ` | The repository owner and name, for issue referred as ` <owner>/<repo>#<issue number> ` . |
462+ | prefix | ` String ` | The prefix used to identify the issue. |
463+ | issue | ` String ` | The issue number. |
464+
358465#### duplicates
359466
360467Type: ` Array<Object> `
@@ -364,7 +471,7 @@ Each duplicate has the following properties:
364471
365472| Name | Type | Description |
366473| --------| ----------| ---------------------------------------------------------------------------------------|
367- | raw | ` String ` | The raw value parsed, for example ` Fix #1` . |
474+ | raw | ` String ` | The raw value parsed, for example ` Duplicate of #1` . |
368475| action | ` String ` | The keyword used to identify the duplicate, capitalized. |
369476| slug | ` String ` | The repository owner and name, for issue referred as ` <owner>/<repo>#<issue number> ` . |
370477| prefix | ` String ` | The prefix used to identify the issue. |
@@ -379,7 +486,7 @@ Each reference has the following properties:
379486
380487| Name | Type | Description |
381488| --------| ----------| ---------------------------------------------------------------------------------------|
382- | raw | ` String ` | The raw value parsed, for example ` Fix #1` . |
489+ | raw | ` String ` | The raw value parsed, for example ` #1 ` . |
383490| slug | ` String ` | The repository owner and name, for issue referred as ` <owner>/<repo>#<issue number> ` . |
384491| prefix | ` String ` | The prefix used to identify the issue. |
385492| issue | ` String ` | The issue number. |
@@ -393,7 +500,7 @@ Each mention has the following properties:
393500
394501| Name | Type | Description |
395502| --------| ----------| ---------------------------------------------|
396- | raw | ` String ` | The raw value parsed, for example ` Fix #1 ` . |
503+ | raw | ` String ` | The raw value parsed, for example ` @user ` . |
397504| prefix | ` String ` | The prefix used to identify the mention. |
398505| user | ` String ` | The user name |
399506
0 commit comments