Skip to content

A Probot extension to make it easier to build commands with syntax similar to GitHub issue closing pattern

License

Notifications You must be signed in to change notification settings

z0al/probot-issue-commands

Repository files navigation

Probot: Issue Commands

Travis npm

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

Installation

$ npm add probot-issue-commands

How it works

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.

Usage

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', ...]
})

Like it?

Give it a star(:star:) :point_up_2:

License

MIT © Ahmed T. Ali

About

A Probot extension to make it easier to build commands with syntax similar to GitHub issue closing pattern

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published