Skip to content

Commit

Permalink
i #230 added function to return GitHub keys
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyjlau committed Apr 10, 2024
1 parent f249709 commit f6e8e31
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions R/config.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ get_project_git_repo_path <- function(project_name) {
#' Gets the list of git branches of the project
#'
#' @param project_name the name of the project config file (e.g. "kaiaulu" or "geronimo")
#' @return the git branches as a list
#' @return the list of git branches
#' @export
get_project_git_branches <- function(project_name) {

Expand Down Expand Up @@ -425,6 +425,27 @@ get_project_mbox_list_key <- function(project_name) {
}
}

#' Get GitHub Project Keys
#'
#' Gets the list of GitHub project keys
#'
#' @param project_name the name of the project config file (e.g. "kaiaulu" or "geronimo")
#' @return the list of GitHub project keys
#' @export
get_project_github_project_keys <- function(project_name) {

conf_path <- paste0("conf/", project_name, ".yml")
conf <- yaml::read_yaml(conf_path)

keys <- conf[["issue_tracker"]][["github"]]

if(is.null(keys)) {
stop("This field does not exist in the configuration file.")
} else {
return(keys)
}
}

#' Get GitHub Project Owner
#'
#' Gets the owner of the GitHub project
Expand Down Expand Up @@ -544,10 +565,10 @@ get_project_jira_project_key_name <- function(project_key_index) {

name <- conf[["issue_tracker"]][["jira"]][[project_key_index]][["project_key"]]

if(is.null(jira_issues_path)) {
if(is.null(name)) {
stop("This field does not exist in the configuration file.")
} else {
return(jira_issues_path)
return(name)
}
}

Expand Down

0 comments on commit f6e8e31

Please sign in to comment.