Skip to content
/ prm Public

Pull Request Monitor (prm) is a CLI tool for listing pull requests from different Source Code Management (SCM) providers.

License

Notifications You must be signed in to change notification settings

dhruv1397/prm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prm (Pull Request Monitor)

prm is a lightweight command-line tool designed to help developers track their pull requests across multiple repositories and Source Code Management (SCM) providers effortlessly.

Highlights

  • Simple Setup: Provide minimal information about the SCM provider, and prm automatically fetches all your repositories.
  • Fast Performance: Fetch all your PRs, even if there are hundreds, in just a couple of seconds.
  • Supports JSON & YAML: Output your data in JSON or YAML for easy integration with other tools.
  • Secure: All data stays on your local machine, ensuring privacy. You can purge any locally persisted data with a single command.

What Are Source Code Management Providers?

A Source Code Management (SCM) provider is any software solution that allows you to host Git repositories, such as GitHub, Harness, GitLab, etc.

Supported SCM Providers

  • GitHub
  • Harness

Requirements

For any SCM provider you want to use, you need to have the following:

  • Host URL: The base URL of that provider (e.g., https://github.com for GitHub or https://app.harness.io for Harness). It can be a cloud service or a self-managed instance, as long as it is accessible from your machine.
  • PAT: The Personal Access Token (PAT) is a secure way to authenticate with your SCM provider. It allows prm to access details like user information, pull requests, and reviewers.

Installation

Using the installation script

Installing the latest version

You can run the following command to download the installation script and install prm. It detects the OS and Arch of your laptop and downloads the latest release of the corresponding binary file.

curl -L https://raw.githubusercontent.com/dhruv1397/prm/main/install.sh | bash
installation

Installing a specific version

To install a specific version, replace target_version with the version number you'd like to install:

curl -L https://raw.githubusercontent.com/dhruv1397/prm/main/install.sh | bash -s -- target_version

Downloading the binary manually

You can download the binary directly from the release page, make it executable and add it to the PATH.

Usage

All flags support shorthands ie -t for --type, -o for --output, -s for --state, -n for --name, etc.

1. Adding a SCM provider

1 SCM provider refers to the group of all the repos which can be accessed by a single PAT.

  • Github
prm add provider my-github --type github --host https://github.com
  • Harness
prm add provider harness-smp --type harness --host https://smp.harness.com

After this you will be prompted to enter your PAT.

add provider

2. Monitoring your PRs

You are ready to start monitoring your PRs. To list all the PRs ie open, closed, merged

prm list prs --state all

To list the open PRs

prm list prs --state open
list pr

You can filter the PRs further by provider type (--type) and provider name (--name).

Changing the output format

You can change the default format from table to json or yaml.
json

prm list prs --output json

yaml

prm list prs --output yaml
yaml-json

3. List your SCM providers

You can check what all SCM providers have been configured.

prm list providers 
list providers

You can filter by name and type.

4. Removing an SCM provider

To remove a provider which is no longer needed or is out of date

prm remove provider my-work-github
remove-provider

5. Refreshing the SCM providers data

This is applicable only to Harness. When you add a Harness SCM provider, prm fetches user and repo related data which it uses to fetch the PRs. This user and repo data is persisted in a file to reduce unnecessary calls during fetching the PRs. If any org, project or repo has been added or removed for the user, we need to refresh the prm config.

prm refresh providers

You can filter by name and type.

6. Purging all the SCM providers data saved by prm

If you wish to remove all the data persisted by prm

prm purge

You will be prompted for confirmation post running this command.

purge

Or you can force it

prm purge --force

Uninstallation

If you want to uninstall prm, you can execute the following

curl -L https://raw.githubusercontent.com/dhruv1397/prm/main/uninstall.sh | bash
uninstall

If prm was installed in a system directory like /usr/local/bin, you might need sudo to uninstall it

Security

It is important to be aware of what data is accessed by any tool to ensure there is no abuse. To ensure your data is secure, prm does not share your data outside your setup. Moreover, it provides the purge command to delete all the data persisted by the app.

Supported configurations (OS/Arch)

  • linux/amd64
  • linux/arm64
  • darwin/amd64
  • darwin/arm64

Check your OS

uname -s | tr '[:upper:]' '[:lower:]'

Check your Arch

uname -m

References

Github

Scopes required for PAT: read:org, repo

Generate PAT (classic): https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-a-personal-access-token
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#personal-access-tokens-classic

API: https://docs.github.com/en/rest?apiVersion=2022-11-28

Harness

Generate PAT: https://developer.harness.io/docs/platform/automation/api/add-and-manage-api-keys/#create-personal-api-keys-and-tokens

API: https://apidocs.harness.io