Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/z0al/probot-issue-commands
A Probot extension to make it easier to build commands with syntax similar to GitHub issue closing pattern
https://github.com/z0al/probot-issue-commands
github github-issues probot probot-extension
Last synced: 2 days ago
JSON representation
A Probot extension to make it easier to build commands with syntax similar to GitHub issue closing pattern
- Host: GitHub
- URL: https://github.com/z0al/probot-issue-commands
- Owner: z0al
- License: mit
- Created: 2017-12-29T14:59:25.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-30T11:47:34.000Z (almost 7 years ago)
- Last Synced: 2024-12-17T02:44:41.212Z (5 days ago)
- Topics: github, github-issues, probot, probot-extension
- Language: TypeScript
- Homepage:
- Size: 12.7 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Probot: Issue Commands
[![Travis](https://img.shields.io/travis/ahmed-taj/probot-issue-commands.svg)](https://travis-ci.org/ahmed-taj/probot-issue-commands)
[![npm](https://img.shields.io/npm/v/probot-issue-commands.svg)](https://www.npmjs.com/package/probot-issue-commands)A Probot extension to make it easier to work with issue commands. It was primarily written to help support GitHub [closing issue pattern](https://help.github.com/articles/closing-issues-using-keywords/) like custom syntax for [DEP](https://github.com/apps/dep)
## Installation
```sh
$ npm add probot-issue-commands
```## How it works
The extension works by matching new issue comments against the following pattern:
```javascript
/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 #2It 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
```javascript
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](https://github.com/ahmed-taj)