Dependabot Is a Contributor, and Other Things My Scripts Got Wrong

I rebuilt my issue-finding scripts as a tested Java tool. Checking every assumption showed that bots, private org members and one API parameter were lying to me.

For a while now I have been finding open source issues to fix with three small Python scripts. Together they were about sixty lines. One counted how many pull requests from outsiders a repository merged in the last 30 days and how long they waited. One listed open issues with a "good first issue" style label that nobody had linked a pull request to. The third looked for recent bug reports from users rather than maintainers.

They worked. They are how I found my two most recent Apache CloudStack fixes, both reproducible bugs that nobody had picked up. But they were the kind of scripts you only trust because you wrote them yesterday. So I rebuilt them as a proper tool in Java, with tests, and called it merge-radar.

Rebuilding them properly meant checking every assumption the scripts made. Several were wrong.

What the tool answers

Two questions, both from the GitHub API:

  1. Does this project merge pull requests from people like me, and how fast?
  2. Which of its open issues is nobody already working on?

Here is the first one, run against a handful of Java projects:

$ merge-radar health --repos-file examples/java-repos.txt
REPO                            SCORE  MERGED  PEOPLE  MEDIAN  ACCEPT
hiero-ledger/hiero-sdk-java        99      13      10     22h     93%
OpenAPITools/openapi-generator     98     129      59    2.5d     88%
keycloak/keycloak                  97    161+      44    3.1d     84%
apache/dolphinscheduler            97      18       9     26h     78%
spring-projects/spring-boot        95      71      32     29h     65%
checkstyle/checkstyle              95    179+      37     27h     67%
apache/cloudstack                  72      42      26   56.6d     82%

"Outsider" means anyone who is not an owner, organisation member or collaborator, and is not a bot. The score adds four capped parts: how many outsider pull requests were merged, how many different people that was, the median time to merge, and the share of decided outsider pull requests that were merged rather than closed.

The CloudStack row is the one I recognise from experience. It merges plenty of outside work, 42 pull requests from 26 people in a month, and accepts 82% of what it decides on. But the median pull request waits almost two months. My domain-limits fix was opened in October and approved in late November. That is not a reason to avoid the project. It is a reason to plan for a long review, and to have something else going in parallel.

Dependabot is a contributor

The first test I wrote used two pull requests recorded from the real CloudStack API: one of my merged ones, and one from Dependabot. This is what GitHub says about the Dependabot one:

"user": { "login": "dependabot[bot]", "type": "Bot" },
"author_association": "CONTRIBUTOR"

According to author_association, Dependabot is a contributor, exactly like me. Count by association alone and every busy repository with dependency updates looks wonderfully welcoming. My old script got away with it because it also checked for a login ending in [bot], almost by accident. merge-radar checks the user type as well, and the recorded Dependabot pull request is now a permanent test case.

Private members look like outsiders

Look at Keycloak in the table: 161 outsider pull requests merged in a month, from 44 people. I had already learned the hard way that this number is too good. When I looked at a Keycloak issue earlier this month, the code it touched was being changed by two core developers at the same time. A newcomer's pull request there would have collided with theirs.

The reason is that organisation membership on GitHub can be private. When it is, the API reports that person as CONTRIBUTOR, not MEMBER. In company-backed projects, many employees keep their membership private, so they count as outsiders. There is no way to tell from the public API.

I could not fix this, so the README says it plainly: in company-backed projects, read the score as an upper bound. A tool that is honest about where it is wrong is more useful than one that pretends to be precise.

"since" does not mean what it says

The issues endpoint takes a since parameter, and I assumed it meant "issues created since". It means "issues updated since". Ask for issues since last week and you get two-year-old issues that someone commented on yesterday. merge-radar passes since to keep the response small, then filters on the creation date itself.

Deciding whether an issue is taken

This is the part that saves the most time. An issue counts as claimed if an open pull request references it, if someone is assigned, or if someone asked to work on it in the last 30 days. If a merged pull request references it, it is probably already fixed.

Requests to work on an issue are where it gets interesting. Most of them are a single comment, "can I take this?", and the person never comes back. So a request older than 30 days is reported as a stale claim but does not hide the issue. Pull requests that were closed without merging do not hide it either; they are shown as earlier attempts, which are usually worth reading before you start.

The phrases are matched narrowly on purpose. "Can I work on this?" is a claim. "Is anyone working on this?" is not, and neither is "I can reproduce this on 4.22". Quoted lines are ignored, so someone replying to an old claim does not count as claiming it. When the matching is unsure, it errs towards showing the issue. Wrongly hiding a good issue costs you the issue. Wrongly showing a taken one costs you ten seconds reading the thread.

Against the real timeline of a CloudStack issue I worked on, the tool gets it right:

CLAIMED: open pull request #14722

That pull request is mine.

Running it for free

Without a token, GitHub allows 60 API requests an hour. Checking one issue costs a request for its timeline, so a run over a few repositories can use a few hundred. I wanted it cheap enough to run every week without thinking about it.

The answer was conditional requests. merge-radar stores every response with its ETag in a small SQLite file. On the next run it sends If-None-Match, and when nothing changed GitHub replies 304 Not Modified, which does not count against the rate limit. After one run over seven repositories, a second run used none of the hourly quota.

When the quota does run out, the client waits for the reset and retries, but only for up to two minutes by default. Past that it stops with a message saying when the limit resets. I would rather get an error than a tool that silently hangs for 58 minutes.

Each repository and each issue timeline is fetched on its own Java virtual thread, with a semaphore capping how many requests are in flight. GitHub's secondary rate limits punish bursts, not totals, so a hundred threads firing at once would be a good way to get blocked.

A weekly digest

The tool also runs as a GitHub Action. Point it at the projects you care about and every Monday it writes a Markdown digest to the job summary, or opens it as an issue. Keep the cache with actions/cache and the weekly run costs almost nothing.

One small trap while building it: a Docker-based action receives its inputs as environment variables named INPUT_<NAME>. I had named an input repos-file, which becomes INPUT_REPOS-FILE. That is a valid environment variable, but bash cannot read a variable with a hyphen in its name. The inputs use underscores now.

What it does not do yet

  • It cannot tell which contributors are really maintainers when GitHub labels them CONTRIBUTOR, as it does for Apache committers.
  • Pull requests linked to an issue only through GitHub's "Development" sidebar appear in the timeline without their number, so the tool misses them unless they also mention the issue. Most do, with "Fixes #123".
  • The claim phrases are English only.

Try it

The code, the scoring rules and the limits are in the repository. It needs Java 21 and borrows your token from the GitHub CLI if you have it logged in:

mvn package -DskipTests
java -jar cli/target/merge-radar.jar issues apache/cloudstack --recent 30d --outsider-reports

If you have been staring at "good first issue" labels wondering why they never lead anywhere, this is the method I use instead, written down as code. And if you find a case where it gets the verdict wrong, open an issue. Nobody has claimed it yet.