I maintain [SumatraPDF](https://www.sumatrapdfreader.org/free-pdf-reader) on GitHub. People fork it and make their own changes. I want to know which forks are active and what they're working on.

GitHub has a [Network tab](https://github.com/sumatrapdfreader/sumatrapdf/network) for this. I find it lousy.

It's hard to see active forks at a glance. Panning and zooming the UI is slow and fiddly. I just want a sorted list of forks with actual changes.

So I wrote a small script: [`github-active-forks.ts`](https://gist.github.com/kjk/71a7679dd408d52bc612cdf5eecace58).

## What it does

It uses the GitHub API to find forks that have **ahead** commits (changes not in upstream) from the last year.

For each active branch it prints:

- a link to the branch on GitHub
- short sha, author, relative date, first line of commit message

Forks are sorted by most recent activity, oldest first. Commits within a branch are oldest first.

It compares each fork branch against the **matching upstream branch** (e.g. `rel3.6working` vs `rel3.6working`), not always `master`. That way you only see commits unique to the fork.

## How to run it

Download the script:

```sh
curl -O https://gist.githubusercontent.com/kjk/71a7679dd408d52bc612cdf5eecace58/raw/7d7f605dde6b739424e5190a79e3988477312e74/github-active-forks.ts
```

You need [Bun](https://bun.sh/) and the [GitHub CLI](https://cli.github.com/) logged in (`gh auth login`). Or set `GITHUB_TOKEN`.

Run it on any repo as `owner/repo`:

```sh
bun github-active-forks.ts sumatrapdfreader/sumatrapdf
```

Progress goes to stderr; results go to stdout, so you can redirect to a file:

```sh
bun github-active-forks.ts sumatrapdfreader/sumatrapdf > forks.txt
```

## Example output

Excerpt from running on SumatraPDF (74 forks with ahead commits):

```
https://github.com/wackget/sumatrapdf-Feldherren-version/tree/single-page-fit-scrollbar  (289d ago)
  c53a51d  wackget  294d ago  Added scrollbar usable in Fit a Single Page display mode.
  f927640  wackget  294d ago  scrollbar in single page mode now obeys the hideScrollbars setting.
  7f57861  wackget  288d ago  improved scrolling speed when zoomed in, in non-continuous single-page view.

https://github.com/xyzzyx99/sumatrapdf/tree/rel3.6working  (5d ago)
  c8d1f7b  xyzzyx99  13d ago  Add GitHub Actions workflow for building project
  8a92547  xyzzyx99  13d ago  Fix bugs, revert using version 3.6
  1f27324  xyzzyx99  13d ago  Save and restore CHM scroll position
  24e7974  xyzzyx99  6d ago  Preserve current CHM URL across tab restore
  30b1cb4  xyzzyx99  5d ago  Update README with new bug fixes and formatting

https://github.com/lsq/sumatrapdf/tree/dev  (today)
  72d7069  lsq  11d ago  feat: support share file via socket
  a1fc427  lsq  10d ago  feat: open home page
  938bc07  lsq  today  add localsend v2.1 api support
```

Much easier to scan than the Network graph.
