Skip to content

Commit

Permalink
bug fix for branches
Browse files Browse the repository at this point in the history
  • Loading branch information
jenna-a2ai committed Dec 23, 2024
1 parent 33a5ec1 commit 868bccc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions R/app_02_resolve.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ ghqc_resolve_app <- function() {
rlang::abort("There were no open Milestones found.")
}

# fetch for other branches that might not be present locally
#suppressMessages(suppressWarnings(gert::git_fetch()))
# invisible(capture.output(gert::git_fetch()))
gert::git_fetch()

app <- shinyApp(
ui = ghqc_resolve_ui(
id = "ghqc_resolve_app"
Expand Down
3 changes: 3 additions & 0 deletions R/app_02_resolve_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ ghqc_resolve_server <- function(id, remote, org, repo, milestone_list) {

all_commits <- reactive({
req(org, repo, issue_parts()$issue_number)


get_commits_df(
issue_number = issue_parts()$issue_number,
file_path = issue_parts()$issue_title,
owner = org,
repo = repo
)
Expand Down
5 changes: 3 additions & 2 deletions R/format_commit_shas.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
# add "second most recent commit", "most recent commit" and "original qc commit" identifiers
# format in table

get_commits_df <- function(issue_number, owner = get_organization(), repo = get_current_repo()) {
get_commits_df <- function(issue_number, file_path, owner = get_organization(), repo = get_current_repo()) {
init_qc_commit <- get_init_qc_commit(owner, repo, issue_number)
branch <- get_branch_from_metadata(owner, repo, issue_number)

all_commits <- gert::git_log()
all_commits <- gert::git_log(ref = paste0("origin/", branch))

cutoff_position <- which(all_commits$commit == init_qc_commit)

Expand Down
8 changes: 8 additions & 0 deletions R/qc_fix.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ get_init_qc_commit <- function(owner, repo, issue_number) {
return(init_commit)
}

get_branch_from_metadata <- function(owner, repo, issue_number) {
issue <- get_issue(owner, repo, issue_number)
text <- get_metadata(issue$body)$`git branch`
branch <- stringr::str_match(text, "\\[(.*?)\\]")[, 2]

return(branch)
}

create_assignees_list <- function(assignees) {
sapply(assignees, function(assignee) glue::glue("@{assignee$login}"))
}
Expand Down

0 comments on commit 868bccc

Please sign in to comment.