Skip to content

CLI tool for showing open PRs for a collection of repos

License

Notifications You must be signed in to change notification settings

goodwid/pr-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to pr-monitor 👋

Documentation Maintenance License: GPL-2.0-only

This started out as a xBar (formerly BitBar) plugin. I had spun off another script that output its data direct to the console for general purpose usage, then realized it needed more work.

It has evolved into a module wrapped in a terminal app that has configuration options, storing the Github token and repositories to track in preferences, or receiving them as parameters as a module.

Usage

As a module

Installation

npm i pr-monitor

const token = '<github Token>'
const repos = [ 'goodwid/github-pr-monitor' ]
const getData =  require('pr-monitor')
const options = { count: true }; // optional, defaults to false

getData(token, repos, options) // returns a JavaScript object
  .then(data => console.log(JSON.stringify(data, null, 2)))
  .catch(err => console.log(err))

The data object returned looks like:

{
  "count": 3,
  "data": {
    "repo1": [
      {
        "name": "alice",
        "branch": "branch1",
        "url": "https://github.com/...pull/298"
      },
      {
        "name": "bob",
        "branch": "branch2",
        "url": "https://github.com/...pull/292"
      }
    ],
    "repo2": [
      {
        "name": "cathy",
        "branch": "branch1",
        "url": "https://github.com/.../pull/97"
      }
    ]
  }
}

as a CLI app

Global installation

npm install pr-monitor -g

# PRs
Total PRs: 1

github-pr-monitor: goodwid on update-readme  https://github.com/goodwid/github-pr-monitor/pull/1

Help is available within the app:

# PRs --help

Usage: PRs [options] [command]

Show current pull requests for all configured repos.

Options:
  -V, --version          output the version number
  -b --bitBar            Outputs data in a format usable by bitBar.
  -t --terminal          Outputs data to the terminal.
  -j --json              Outputs data in JSON format.
  -x --xml               Outputs data in XML format.
  -c --count             Only show the number of PRs
  -N --nocolor           Omit colors in terminal output
  -h, --help             output usage information

Commands:
  config [options]       Configure the application
  show-config [options]  Display the current repositories monitored.
  clear [options]        Clears all current configuration data.

Subcommands

config

# PRs config --help
Usage: config [options]

Configure the application

Options:
  -g --githubToken <githubToken>  Github token to use for API call
  -a --addRepo <repoToAdd>        Add a repository to the monitor list
  -r --removeRepo <repoToRemove>  Remove a repository from the monitor list
  -d --defaultFormat <format>     Select a default format to use
  -h, --help                      output usage information

show-config

# PRs show-config --help
Usage: show-config [options]

Display the current repositories monitored.

Options:
  -s --showKeys  Displays the Github token as well
  -h, --help     output usage information

clear

# PRs clear --help
Usage: clear [options]

Clears all current configuration data.

Options:
  -g --githubToken  Removes just the Github token
  -r --repos        Removes just the repository data
  -h, --help        output usage information

To use this project with xBar

  • add your github token: pr-monitor config -g <token>
  • add your repository: pr-monitor config -a <org>/<repo>
  • set your default display pr-monitor config -d bitBar
  • create a symbolic link from your xbar dir to index.js: `ln -s pr-monitor /path/to/bitbar/github-pr-5m.js'

Author

👤 David Goodwin <[email protected]>

🤝 Contributing

Contributions, issues and feature requests are welcome !
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you !

📝 License

Copyright © 2019 David Goodwin <[email protected]>.
This project is GPL-2.0-only licensed.


This README was generated with ❤️ by readme-md-generator

About

CLI tool for showing open PRs for a collection of repos

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •