-
Notifications
You must be signed in to change notification settings - Fork 34
Add issue service
IMPORTANT Since version 2.0.0, all the API is promise-based.
Issue services are located in lib/issue-service.
Fork and create a new module lib/issue-service/<your-service>, based on doc/issue-service/sample.js
You should take a look at lib/issue-service/github.js for inspiration (particularly user interaction using Inquirer for OAuth authentication).
Once you're happy with your implementation, create a new Pull Request and let's all party!
Your module must expose the following API (last 2 methods must be synchronous):
-
metais an optional descriptive object with following properties:-
desc(optional) your service short description -
repo(optional) expected format of the "repo" option for this service -
conf(optional) list of configuration options that your service relies on (best for credentials storage)
-
-
connect(configuration)-
configurationcontains user configuration - returns promise of an API client
-
-
allIssues(client, repo)-
clientyour API client (got fromconnect) -
repouser's "repo" option (same for all other methods) - returns promise of
Issues
-
-
findIssueByTitle(client, repo, title)- returns promise of found
Issue
- returns promise of found
-
createIssue(client, repo, title, body, labels)-
bodyis the text of the issue, in Github-flavored Markdown format -
labelsis an array of String, they should be created if necessary (*) - returns promise of created
Issue
-
-
commentIssue(client, repo, id, comment)-
idis issue's identifier -
commentis comment's texte, in Github-flavored Markdown format - returns promise of created
Comment
-
-
tagIssue(repo, id, label)-
idis issue's identifier -
labelis the tag name that should be added to issue's labels, this method should not replace but add a new label to the list - returns promise of updated
Issue
-
- (optional)
validateConfig(conf)- called just before
connectto validate options -
confis the global options object - returns promise of valid configuration
- called just before
-
guessRepoFromUrl(url)-
urlthe git remote url - returns value (or promise of value) for "repo" option, or falsey otherwise
-
-
getFileUrl(client, repo, path, sha, line)-
pathis project relative path to file -
shais the commitish to which we want to generate link (*) -
lineis the target line number (*) - returns the most precise URL available to source file
-
(*) obviously only if your service supports this feature
-
Issue-
type:String="issue" -
number:Number -
url:String -
title:String -
labels:Array of String
-
-
Comment-
type:String="comment" -
issue:Number -
url:String
-
You may need to store data in user configuration, as it's done with Github service for OAuth token and API access.
- Prefix your option with service identifier
- Document your options in doc/cli/help.config.txt
- Declare your options in your service's
meta.conf: they will automatically added as non-extra and globals - For more fine-grained control you'll have to declare your options in lib/config.js:
- Default values in
module.exports.defaults - Add to
module.exports.globalsif they should be global - Add to
module.exports.booleansthe flag-options
- Default values in
Enable it in a sample repository:
github-todos config service <your-service>Then create commits, and simulate push:
DRY_RUN=1 DEBUG=* git pushDon't forget to check it generates nice user-friendly documentation in github-todos list-services, edit your meta to tweak it.