Skip to content

A client which calls the github api to query branch creation and merge date

License

Notifications You must be signed in to change notification settings

markus-codechefs/github-branch-metrics

Repository files navigation

Github branch lifetime measurmenet tool

GitHub release License issues - github-branch-lifetime CII Best Practices

CI

Quality Gate Status example workflow example workflow

Short summary

A base package will offer the statistic to display for other apps. A blazor app and a console app are offered as examples. They will call the package which then calls the github api to query the branch statistics.

Why is branch lifespan important?

Data from the book "Accelerate" and "State of DevOps Report" have shown that consistently merging code to trunk (repository main branch) multiple times a day delivers high performance in technology organizations.

https://techbeacon.com/app-dev-testing/how-trunk-based-delivery-key-faster-more-reliable-software

At the time of writing I have not found any library which offers to measure the amount of time spent developing on non-trunk branches. Measuring the lifespan of your organisation's feature branches will give insight into:

  • the state of software delivery in general
  • the average batch size being delivered
  • the average lead time to deliver a feature

image

Some context

There is no branch creation date in github as a branch is merely a pointer to a commit. So the most sane thing I came up with was the oldest commit on a branch.

Get all Pull Requests

https://api.github.com/repos/markus-codechefs/github-branch-lifetime/pulls

  • Uses the MergedAt date as the end date of the measurement.

Get all commits per Pull Request

https://api.github.com/repos/{org}/{repo}/pulls/{PR.Number}/commits

  • Uses CreatedAt of the oldest commit on a branch for the start of the measurement.

License

Released under MIT by @markus-codechefs.

About

A client which calls the github api to query branch creation and merge date

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published