Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gains output table with worfklow information #27

Merged
merged 6 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: pacta.sit.rep
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9004
Version: 0.0.0.9006
Authors@R:
person("Jackson", "Hoffart", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-8600-5042"))
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(generate_package_table)
export(generate_workflow_table)
importFrom(rlang,.data)
55 changes: 55 additions & 0 deletions R/generate_workflow_table.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#' Generate a table with worfklow information
#'
#' @param repo_paths A character vector with GH paths to the workflow
#' repositories
#'
#' @return A tibble with the following columns:
#' * Repo
#' * Lifecycle
#' * Docker Status
#' * Latest_SHA
#' * Maintainer
#'
#' @export
#'
#' @examples
#' generate_workflow_table("RMI-PACTA/workflow.transition.monitor")
generate_workflow_table <- function(repo_paths) {
out <- tibble::tibble(
repo = repo_paths,
lifecycle = purrr::map_chr(repo_paths, table_lifecycle),
docker = purrr::map_chr(repo_paths, table_docker),
sha = purrr::map_chr(repo_paths, table_latest_sha),
maintainer = purrr::map_chr(repo_paths, table_maintainer)
)

dplyr::transmute(
out,
Repo = format_repo_v(.data[["repo"]]),
Lifecycle = format_lifecycle_v(.data[["lifecycle"]]),
Docker_Status = format_docker_v(.data[["docker"]]),
Latest_SHA = format_latest_sha_v(.data[["repo"]], .data[["sha"]]),
Maintainer = format_maintainer_v(.data[["maintainer"]])
)
}

format_docker <- function(docker_status) {

if (is.na(docker_status)) {
return("No Docker check found.")
}

docker_status
}

format_docker_v <- Vectorize(format_docker)

table_docker <- function(repo_path) {
readme <- get_gh_text_file(repo_path, file_path = "README.md")

docker_action_names <- "docker.yml|build-Docker-image-triggers.yml"

docker_status <- readme[grepl(docker_action_names, readme)]

return(docker_status)
}
Loading
Loading