Skip to content

Repository files navigation

issue-closer

Close GitHub Issues client for Node.js

CircleCISupport Node.js versionLicense: MIT

Usage

Install

$ npm i @gamewith/issue-closer --save

Client

See TaskOption

constCloser=require('@gamewith/issue-closer');// GitHub TOKEN// @see https://github.com/settings/tokensconsttoken='xxx';constcloser=newCloser(token,{// Repository ownerowner: 'xxx',// Target repositoryrepository: 'xxx'});// Add taskcloser.add('sample',{filter: (issue)=>issue.number===1,query: {labels: 'done'},sleep: 100});// Run close issuescloser.run('sample').then((closedIssues)=>{console.info(closedIssues);}).catch((err)=>{console.error(err);});

CLI

  1. Create config file

    $ node_modules/.bin/icloser init
    // created ./.icloser.js
    

    Change destination path.

    $ node_modules/.bin/icloser init --path=/path/to
    // created /path/to/.icloser.js
    
  2. Run close issues

    Default is to close all issues.

    $ node_modules/.bin/icloser
    

    Specify a task.

    $ node_modules/.bin/icloser --task=sample
    

    Change the reference destination of config file.

    $ node_modules/.bin/icloser --configPath=/path/to/.icloser.js
    

Config

/path/to/.icloser.js

See TaskOption

'use strict';module.exports={// GitHub TOKEN// @see https://github.com/settings/tokenstoken: 'xxx',config: {// Repository ownerowner: 'xxx',// Target repositoryrepository: 'xxx'},tasks: {sample: {filter: (issue)=>issue.number===1,query: {labels: 'done'}}}};

Overwrite default

'use strict';module.exports={// GitHub TOKEN// @see https://github.com/settings/tokenstoken: 'xxx',config: {// Repository ownerowner: 'xxx',// Target repositoryrepository: 'xxx'},tasks: {default: {filter: (issue)=>issue.number===1,query: {labels: 'done'}},sample: {filter: (issue)=>issue.number===2}}};

TaskOption

{// Filter issue with logic.// When undefined, it does not filter issue.// @type function(issue): bool or undefined// @see https://developer.github.com/v3/issues/#list-issues-for-a-repositoryfilter: (issue)=>issue.number===1,// Filter by query of GitHub API.// When undefined, it get all issues.// @type Object or undefined// @see https://developer.github.com/v3/issues/#list-issues-for-a-repositoryquery: {labels: 'done'},// Sleep every 20 issues.// When close a large number of issues, it use to avoid Limit of GitHubAPI.// When undefined it does not sleep.// @type Number or undefined// @see https://developer.github.com/v3/#rate-limitingsleep: 10//msec}

LICENSE

MIT

About

Close GitHub Issues client for Node.js

Resources

Stars

1 star

Watchers

22 watching

Forks

Releases

Packages

Used by

Contributors

Languages