Close GitHub Issues client for Node.js
$ npm i @gamewith/issue-closer --save
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);});Create config file
$ node_modules/.bin/icloser init // created ./.icloser.jsChange destination path.
$ node_modules/.bin/icloser init --path=/path/to // created /path/to/.icloser.jsRun close issues
Default is to close all issues.
$ node_modules/.bin/icloserSpecify a task.
$ node_modules/.bin/icloser --task=sampleChange the reference destination of config file.
$ node_modules/.bin/icloser --configPath=/path/to/.icloser.js
/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}}};{// 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}