ghoc
v0.0.2
Published
Utility for work with github rest api and filter responses
Readme
Github org checker
Node.js wrapper around github rest api with priority to get pull requests and repositories from single organization.
Installation
with yarn:
yarn add github-org-checkerwith npm
npm install github-org-checkerUsage
For use it, you need pass personal access token from github to this library and add organization name.
const GithubOrgChecker = require('github-org-checker')
const apiWrapper = new GithubOrgChecker({ GH_TOKEN: 'your token', GH_ORG: 'Qlean' })
apiWrapper.repos().then(
data => { console.log(data.map(repo => repo.name)) }
).catch(err => {
console.log(err)
})API
repos
ghoc.repos() // return all repositories from organization.params
const params = {
language: 'javascript', // Filter all repos by language
private: true, // Filter all repos by private status
withIssues: true // Get repos only with open issues
}
const promise = ghoc.repos(params)pullRequests
ghoc.pullRequests(repoParams, prParams) // return all opened pull requestsThere are 2 differend param objects:
repoParams
This is params for filtering repositories, where a library must find pull requests. You can pass array with repository names, if you with get requests only from target repositories:
const repoParams = {
repos: ['redux-struct', 'eslint-config-qlean']
}or use default params from repos api:
const repoParams = {
language: 'javascript', // Filter all repos by language
private: true, // Filter all repos by private status
withIssues: true // Get repos only with open issues
}prParams
const prParams = {
state: 'open', // or 'closed'.
label: 'need reviews',
author: 'idanieru'
}