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

ENH: Triggers with source code #165

Open
muschellij2 opened this issue Jan 10, 2022 · 1 comment
Open

ENH: Triggers with source code #165

muschellij2 opened this issue Jan 10, 2022 · 1 comment

Comments

@muschellij2
Copy link
Contributor

Is there use to have this in the package:

cr_buildtrigger_list_full = function(projectId = googleCloudRunner::cr_project_get()) {
  triggers = googleCloudRunner::cr_buildtrigger_list(projectId = projectId)
  if (NROW(triggers) == 0 || length(triggers) == 0) return(NULL)
  triggers$id = triggers$buildTriggerId
  trigger_data = lapply(triggers$buildTriggerId, function(triggerId) {
    x = googleCloudRunner::cr_buildtrigger_get(triggerId = triggerId, 
                                           projectId = projectId)
    tibble::tibble(buildTriggerId = triggerId, build = list(x))
  })
  trigger_data = dplyr::bind_rows(trigger_data)
  data = dplyr::full_join(triggers, trigger_data)
  return(data)  
}

(non-dplyr version)

cr_buildtrigger_list_full = function(projectId = googleCloudRunner::cr_project_get()) {
  triggers = googleCloudRunner::cr_buildtrigger_list(projectId = projectId)
  if (NROW(triggers) == 0 || length(triggers) == 0) return(NULL)
  triggers$id = triggers$buildTriggerId
  trigger_data = lapply(triggers$buildTriggerId, function(triggerId) {
    x = googleCloudRunner::cr_buildtrigger_get(triggerId = triggerId, 
                                           projectId = projectId)
    tibble::tibble(buildTriggerId = triggerId, build = list(x))
  })
  trigger_data = do.call(rbind, trigger_data)
  data = merge(triggers, trigger_data, all = TRUE, by = "buildTriggerId")
  return(data)  
}
@MarkEdmondson1234
Copy link
Owner

Sure would be cool - I'd prefer it as an option flag on cr_buildtrigger_list() so something like cr_buildtrigger_list(full=TRUE) to opt-in. Yes needs to not pull in any extra dependencies.

muschellij2 added a commit to muschellij2/googleCloudRunner that referenced this issue Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants