Created
April 14, 2020 21:05
-
-
Save SteveBronder/bdfe99e216e71a12a41832249516f913 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| library(gh) | |
| library(data.table) | |
| # Cycles through the PR pages grabbing useful info | |
| all_prs = list()[30 * 12] | |
| stan_math_prs = list()[30 * 12] | |
| for (i in 1:12) { | |
| stan_math_prs[[i]] = gh("GET https://api.github.com/repos/stan-dev/math/pulls?state=closed", type = "public", page = i) | |
| } | |
| for (i in 1:12) { | |
| all_prs[[i]] = lapply(stan_math_prs[[i]], function(x) { | |
| if (is.null(x$merged_at)) { | |
| merged_date = NA | |
| } else { | |
| merged_date = x$merged_at | |
| } | |
| return(data.table(closed_date = x$closed_at, merged_date = merged_date, branch = x$head$ref, | |
| title = x$title, user = x$user$login, | |
| pr_url = x$html_url, user_url = x$user$html_url, pr_number = x$number)) | |
| }) | |
| } | |
| all_pr_dt = rbindlist(lapply(all_prs, rbindlist)) | |
| release_pr_dt = all_pr_dt[merged_date > "2019-07-18"] | |
| ## Attempts to label fix or feature | |
| release_pr_dt[grepl("bug", branch), type := "fix"] | |
| release_pr_dt[grepl("fix", branch), type := "fix"] | |
| release_pr_dt[grepl("clang", branch), type := "fix"] | |
| release_pr_dt[grepl("cleanup", branch), type := "fix"] | |
| release_pr_dt[grepl("refactor", branch), type := "fix"] | |
| release_pr_dt[grepl("opencl", branch), type := "fix"] | |
| release_pr_dt[grepl("matrix_cl", branch), type := "fix"] | |
| release_pr_dt[grepl("test", branch), type := "fix"] | |
| release_pr_dt[grepl("feature", branch), type := "feature"] | |
| release_pr_dt[grepl("Feature", title), type := "feature"] | |
| release_pr_dt[grepl("gpu", tolower(branch)), type := "feature"] | |
| release_pr_dt[grepl("cpu", tolower(branch)), type := "feature"] | |
| release_pr_dt[is.na(type)] | |
| release_pr_dt[, pr_url := paste0("(", pr_url, ")")] | |
| release_pr_dt[, user_url := paste0("(", user_url, ")")] | |
| release_pr_dt[, user := paste0("[", user, "]")] | |
| release_pr_dt[, pr_number := paste0("[#", pr_number, "]")] | |
| # This was reverted | |
| release_pr_dt = release_pr_dt[title != "implement GPU caching"] | |
| release_pr_dt = release_pr_dt[!grepl("Revert", title)] | |
| # Make the graphs | |
| release_table = release_pr_dt[, .(type = type, Contributor = paste0(user, user_url, " : (", pr_number, pr_url, ")"), Title = title)] | |
| feature_table = release_table[type == "feature"] | |
| fix_table = release_table[type == "fix"] | |
| feature_table[, type := NULL] | |
| fix_table[, type := NULL] | |
| knitr::kable(feature_table) | |
| knitr::kable(fix_table) | |
| rbindlist(all_prs[[1]]) | |
| all_prs[[1]][1] | |
| all_prs[[1]][20] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment