Skip to content

Instantly share code, notes, and snippets.

@zkamvar
Last active August 7, 2023 20:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zkamvar/3a10ae2b505dc8335a0b1393f71853ae to your computer and use it in GitHub Desktop.
Save zkamvar/3a10ae2b505dc8335a0b1393f71853ae to your computer and use it in GitHub Desktop.
Get maintainers who still need to confirm that they have reset their local repositories
#' List maintainers who still need to respond to the Workbench transition issue
#'
#' @param org the name of the github organisation
#' @param repo name of the repository
#' @return a character vector of github user names for maintainers who still need to confirm
#' transition to The Workbench
#'
#' @details The Workbench transition requires maintainers to confirm that they have re-cloned
#' their local repositories to avoid a situation where they overwrite commits with the old
#' version of the repository
get_no_response_members <- function(org, repo) {
# get the github teams
teams <- gh::gh("/repos/{org}/{repo}/teams", org = org, repo = repo)
names <- purrr::map_chr(teams, "name")
# the teams response will always have a URL where we can access the "members" endpoint
# (I believe this requires "org:read" access)
team_members <- purrr::map(teams, function(team) gh::gh(glue::glue("{team$url}/members")))
names(team_members) <- names
# we only want to compare teams that are "-maintainers" and "-maintainers-workbench"
team_members <- team_members[grepl("-maintainers", names)]
maintain <- purrr::map(team_members, function(member) purrr::map_chr(member, "login"))
if (length(maintain) > 1) {
# team members who are not in the workbench team will be returned
wb <- endsWith(names(maintain), "-workbench")
setdiff(maintain[!wb][[1]], c("maneesha", maintain[wb][[1]]))
} else {
# if there is no maintainers-workbench team, then we will return null
return(NULL)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment