A Probot extension to make it easier to work with issue commands. It was primarily written to help support GitHub closing issue pattern like custom syntax for DEP
$ npm add probot-issue-commands
The extension works by matching new issue comments against the following pattern:
/CMD +((([\w-.]+\/[\w-.]+)?#\d+) *((, *)? *and +|, *)?)+/i
Which should match e.g:
- CMD #1
- CMD #1, #2
- CMD #1, #2, and #3
- CMD #1 #2
- CMD #1 and #2
It also supports owner/repo#ID
syntax to reference issues in different repositories.
Internally the extension replaces CMD
with your command regex's source (without any options i.e. g
) and then execute result against comment body.
const { addCommand } = require('probot-issue-commands')
// Type `closes #1, and owner/repo#2`
addCommand(robot, /clos(es|ing)/, (context, issues) => {
console.log(issues)
// ['#1','owner/repo#2', ...]
})
Give it a star(:star:) :point_up_2:
MIT © Ahmed T. Ali