jonathan warykowskijwarykowski

herdr-gh

A herdr plugin that puts each workspace's pull request in the sidebar: its number, CI and review, next to the branch.

herdr-gh shows each herdr workspace’s pull request in a few characters, next to its branch, and can run your own commands when a PR is merged, CI finishes or a review comes in.

◑ api-auth-fix
  fix/auth-expiry #412│×│!
✓ docs-update
  docs/readme #415│√│+
● search
  feat/search d418│•
SymbolMeans
#412, d412PR number; d is a draft
√ × •CI passed, failed, running
+ !Review approved, changes requested
↗Merged: time to remove the worktree
†Closed without merging

Install

You need herdr 0.9.3 or later, gh logged in, jq and git.

herdr plugin install jwarykowski/herdr-gh

Then add $gh to the sidebar in herdr’s config.toml:

[ui.sidebar.spaces]
rows = [["state_icon", "workspace"], ["branch", "git_status", "$gh"]]

It checks every minute, about one GitHub API call per workspace.

Hooks

An executable named after an event, in $(herdr plugin config-dir jwarykowski.herdr-gh)/hooks/, runs when it happens: pr.merged, pr.closed, ci.passed, ci.failed, review.approved and review.changes_requested. It gets the PR’s number, URL, repo, title and branch in HERDR_GH_* variables. Party lights when a PR merges, with herdr-zsa-lights, in hooks/pr.merged:

#!/bin/sh
herdr plugin action invoke party --plugin jwarykowski.herdr-zsa-lights

Actions and settings

jwarykowski.herdr-gh.refresh checks now; jwarykowski.herdr-gh.restart picks up a changed config.env. The symbols and the polling interval are all settings: see config.env.example.