Created
February 25, 2022 16:33
-
-
Save agerlach/831beb95d82b87ffcc4657c668139ebe to your computer and use it in GitHub Desktop.
SciML Release Stats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create GITHUB_AUTH environmental variable w/ GitHub Personal access token | |
using Dates | |
import GitHub; const GH = GitHub | |
auth = GH.authenticate(ENV["GITHUB_AUTH"]) # don't hardcode your access tokens! | |
user = "SciML" | |
isorg = true | |
since_dt = DateTime(2021) | |
# Get org repos | |
repos, _ = GH.repos(user, isorg; auth) | |
# Get repo releases | |
repo_releases = Dict{String, Vector{GH.Release}}() | |
for repo ∈ repos | |
releases, _ = GH.releases(repo; auth) | |
repo_releases[repo.name] = releases | |
end | |
# Filter for releases since `since_dt` | |
release_dts = vcat([DateTime.(getfield.(v, :created_at), dateformat"y-m-dTH:M:SZ") | |
for (k, v) in repo_releases]...) | |
sort!(release_dts) | |
last_year = filter( >(since_dt), release_dts) | |
# Average, note diff(DateTime) -> millisecond | |
ms2hr = .001/60/60 | |
ave_release_hr = sum(diff(last_year)).value / length(last_year) * ms2hr | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment