Skip to content

dhth/prs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

41 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

prs

✨ Overview

prs lets you stay updated on pull requests from your terminal.

Usage

source video

πŸ€” Motivation

For my day job as a tech lead, I need to stay updated on several PRs, and my hope is that prs will let me do that faster than the Github web UI (or other tools for that matter).

πŸ’Ύ Installation

homebrew:

brew install dhth/tap/prs

go:

go install github.com/dhth/prs@latest

Or get the binaries directly from a release. Read more about verifying the authenticity of released artifacts here.

πŸ”‘ Authentication

You can have prs make authenticated calls to GitHub on your behalf in either of two ways:

  • Have an authenticated instance of gh available (recommended).
  • Provide a valid Github token via $GH_TOKEN.

⚑️ Usage

prs has two modes:

  • Query mode (default): lets you search PRs based on a query you provide (based on github's search syntax)
  • Repos mode: let you pick a repository from a predefined list

Query Mode

prs --query='type:pr repo:neovim/neovim state:open label:lua linked:issue'

# view open PRs where you're the author
prs -q 'type:pr author:@me state:open'

# view open PRs where a review has been requested from you
PRS_QUERY='type:pr user-review-requested:@me state:open' prs

# read query from prs' config file
prs

Repos Mode

prs --mode=repos --repos='dhth/prs,dhth/omm,dhth/hours'

PRS_REPOS='dhth/prs,dhth/omm,dhth/hours' prs --mode=repos

# read repos from prs' config file
prs -m repos

πŸ› οΈ Configuration

prs accepts configuration from any of the following:

  • Command line flags (run prs -h for details)

  • Environment variables (eg. PRS_QUERY)

  • prs's config file, which looks like this:

    num: 20
    repos:
      - dhth/omm
      - dhth/hours
      - dhth/prs
      - neovim/neovim
      - junegunn/fzf
      - BurntSushi/ripgrep
      - charmbracelet/bubbletea
      - goreleaser/goreleaser
      - dandavison/delta
    query: 'type:pr repo:neovim/neovim state:open label:lua linked:issue'

For every configuration property, the order of priority is: flag >> environment variables >> config file, ie, flags take the highest priority.

^ back to top ^

Screenshots

PR List View

Screen 1

PR Timeline List View

Screen 2

PR Timeline Item Detail View

Screen 3

PR Details View

Screen 4

Screen 5

Screen 6

Screen 7

^ back to top ^

Keyboard Shortcuts

General

  q/esc/ctrl+c                      go back
  Q                                 quit from anywhere
  ?                                 Open Help View
  d                                 Open PR Details View
  ctrl+v                            Show PR details using gh

PR List View

  Indicators for current review decision:

  Β±  implies                        CHANGES_REQUESTED
  🟑 implies                        REVIEW_REQUIRED
  βœ… implies                        APPROVED

  ⏎/tab/shift+tab/2                 Switch focus to PR Timeline View
  ctrl+s                            Switch focus to Repo List View (when --mode=repos)
  ctrl+d                            Show PR diff
  ctrl+r                            Reload PR list
  ctrl+b                            Open PR in browser

PR Details View

  h/N/←                             Go to previous section
  l/n/β†’                             Go to next section
  1/2/3...                          Go to specific section
  J/]                               Go to next PR
  K/[                               Go to previous PR
  d                                 Go back to last view
  ctrl+b                            Open PR in browser

Timeline List View

  tab/shift+tab/1                   Switch focus to PR List View
  ⏎/3                               Show details for PR timeline item (when applicable)
  ctrl+d                            Show PR diff
  ctrl+b                            Open timeline item in browser
  ctrl+r                            Reload PR timeline

Timeline Item Detail View

  1                                 Switch focus to PR List View
  2                                 Switch focus to PR Timeline List View
  ctrl+d                            Show PR diff
  ctrl+b                            Open timeline item in browser
  h/N/←                             Go to previous section
  l/n/β†’                             Go to next section

πŸ” Verifying release artifacts

In case you get the prs binary directly from a release, you may want to verify its authenticity. Checksums are applied to all released artifacts, and the resulting checksum file is signed using cosign.

Steps to verify (replace the version in the commands listed with the one you want):

  1. Download the following files from the release:

    • prs_1.0.0_checksums.txt
    • prs_1.0.0_checksums.txt.pem
    • prs_1.0.0_checksums.txt.sig
  2. Verify the signature:

    cosign verify-blob prs_1.0.0_checksums.txt \
        --certificate prs_1.0.0_checksums.txt.pem \
        --signature prs_1.0.0_checksums.txt.sig \
        --certificate-identity-regexp 'https://github\.com/dhth/prs/\.github/workflows/.+' \
        --certificate-oidc-issuer "https://token.actions.githubusercontent.com"
  3. Download the compressed archive you want, and validate its checksum:

    curl -sSLO https://github.com/dhth/prs/releases/download/v1.0.0/prs_1.0.0_linux_amd64.tar.gz
    sha256sum --ignore-missing -c prs_1.0.0_checksums.txt
  4. If checksum validation goes through, uncompress the archive:

    tar -xzf prs_1.0.0_linux_amd64.tar.gz
    ./prs
    # profit!

Acknowledgements

prs is built using bubbletea, and released via goreleaser.

^ back to top ^