Skip to main content

2 posts tagged with "mergestat"

View All Tags

Patrick DeVivo

Unanswered issues and pull requests on GitHub repos are no fun, especially if you're the one asking for help 🙂. I've seen many projects making use of automation to close (or comment on) them, though folks have argued against that.

Regardless, identifying unanswered issues can be valuable, especially for maintainers to ensure they're addressing user concerns - or even for anyone looking for places to help.

You can use the MergeStat GitHub tables to identify stale issues or PRs in a repo (or even across many repos).

info

MergeStat is an open-source tool for running SQL queries against git repositories and related data sources (like the GitHub API). Check us out if you're not familiar.

Stale Issues

This will return the oldest 25 issues created more than 30 days ago, with no comments, that remain open.

SELECT
title, author_login, comment_count, created_at, url
FROM github_repo_prs('uber-go/zap') -- replace with your repo
WHERE
created_at < date('now', '-30 days') -- replace with how long you care about (https://www.sqlite.org/lang_datefunc.html)
AND (merged = 0 OR closed = 0)
AND comment_count = 0
ORDER BY created_at ASC
LIMIT 25

(see example output)

Stale PRs

SELECT
title, author_login, comment_count, created_at, url
FROM github_repo_prs('mergestat/mergestat') -- replace with your repo
WHERE
created_at < date('now', '-30 days') -- replace with how long you care about (https://www.sqlite.org/lang_datefunc.html)
AND merged = 0
AND closed = 0
AND comment_count = 0
ORDER BY created_at ASC
LIMIT 25
note

You can run these queries either in the Public workspace or by installing the CLI. In either case you will need to supply a GitHub token for API authentication.

export GITHUB_TOKEN="my-github-token"
cat query.sql | mergestat -v

Considerations

  1. Maybe comment_count = 0 isn't good enough to indicate "staleness" - maybe finding issues/PRs where there are only comments from the original author, or where there are no comments from maintainers is more accurate.
  2. The above queries can be joined with github_org_repos to see stale PRs and issues across an entire org, not just in a single repo.
  3. Maybe you could produce a dashboard (charts) to track issue staleness and alert on it - an SLA on issue response time?

If you're interested in exploring these use cases, feel free to come say hi on our Slack or shoot us a note on Twitter.

Patrick DeVivo

AskGit, the command line tool for querying git repositories with SQL, is now called MergeStat (the command is now mergestat) and you can find our new home on GitHub at mergestat/mergestat and our new homepage at mergestat.com.

This is also the first post on our new blog and dedicated documentation site, welcome! 🎉

Why the change?

In short, to decenter git from our name. AskGit has carried us a long way as a tool focused on querying the history and contents of git repositories, and that functionality remains a core part of what we're building. However, as we look towards what's next, much of what we hope to make accesssible via our SQL environment is the ability to query software development in general, not just git repositories. That being said, git remains the backbone of so much of software development anyway, and as such, remains a key part of our project.

MergeStat is an allusion to our deep tie to git data (source code and commit history), but also is meant to convey the "bringing together" of a broader array of data sources we will be supporting.

Join us on Slack

We're also launching a new dedicated Slack Community - come hang out with us there - bring questions and any interesting queries!