Created
December 18, 2024 12:17
-
-
Save jakubsob/16d9fe7560a74189099bd7553f41d916 to your computer and use it in GitHub Desktop.
Open a PR using a selected template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.get_active_branch <- function() { | |
res <- system("git status", intern = TRUE) | |
stringr::str_remove(res[1], "On branch ") | |
} | |
#' It opens a PR in the repository with the selected template | |
#' | |
#' The only way to open a PR with a specific template is to use the query parameters: | |
#' https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/using-query-parameters-to-create-a-pull-request | |
.open_pr <- function( | |
repository, | |
from = .get_active_branch(), | |
to = "dev", | |
template = "dev.md") { | |
browseURL(glue::glue("{repository}/compare/{to}...{from}?expand=1&template={template}")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment