/ada-pr-checker

Check PR request status for a (known) set of users and repositories.

Primary LanguageJavaScriptApache License 2.0Apache-2.0

PR Status checker

This tool checks student pull request status using the GitHub REST API.

Installation

npm i -g https://github.com/ace-n/ada-pr-checker

Optional: increase your GitHub rate limits

  1. Open the GitHub personal access token creation page in your browser
  2. Check only the repo_status and public_repo checkboxes. Make sure any others are unchecked!
  3. Click Generate token and copy the resulting value
  4. Configure prcheck to use the token. Replace <YOUR_GITHUB_TOKEN> in the command below with the value you obtained in the previous step:
prcheck setConfig githubAuthToken <YOUR_GITHUB_TOKEN>

Configuration

This application uses configstore for configuration.

Commands

Use the following commands to work with config values:

  • prcheck setConfig - sets a config value (e.g. prcheck setconfig githubAuthToken <MY_TOKEN>)
  • prcheck getConfig - prints a config value (e.g. prcheck getconfig githubAuthToken)
  • prcheck listConfig - prints all config values
  • prcheck deleteConfig - unsets a config value (e.g. `prcheck deleteConfig)

Settings

The following are permitted config values:

  • githubAuthToken - the Auth token to use when making GitHub requests. (Optional, but increases rate limits.)
  • githubAuthors - only review PRs authored by these usernames (wildcard: @)
  • githubOrg - the GitHub organization (or username) that PRs are sent to (defaults to Ada-C###, where ### is the current cohort number)
  • cacheExpiry - how long to cache GitHub requests for before updating them
  • allGithubRepos - a list of GitHub repos to review if prcheck check receives a wildcard (@)

Usage

prcheck <command>

Commands:
  prcheck setConfig <key> <values...>  Sets a config value.
  prcheck getConfig <key>              Gets a config value.
  prcheck deleteConfig <key>           Deletes a config value.
  prcheck listConfig                   List all config values
  prcheck check <repos...>             Checks for PR status

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]

Examples:
  prcheck setConfig githubAuthToken         Set your GitHub auth token
  MY_AUTH_TOKEN
  prcheck setConfig githubAuthors ace-n     Set a GitHub author to check by
                                            default
  prcheck setConfig githubAuthors ace-n     Set multiple GitHub authors to check
  shrutivanw                                by default
  prcheck check repo_1 repo_2               Search for PRs from repo_1 and
                                            repo_2. Filter authors based on
                                            config.json (default: no filter)
  prcheck check repo_1 repo_2 --authors     Search for PRs from repo_1 and
  user_1 user_2                             repo_2 with authors user_1 and
                                            user_2
  prcheck check @ --authors user_1 user_2   Search for PRs from any repo with
                                            authors user_1 and user_2
  prcheck check @ --authors @               Search for PRs from all repos
                                            authored by anyone

Caching

GitHub requests are cached in the cache/ directory. (This directory will automatically be created if it doesn't exist.)

License

Licensed under the Apache 2.0 license.