Skip to content

Allow review_pull_request() to get advisories and organizations if no… #81

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

Merged
merged 1 commit into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -2,7 +2,7 @@ Package: multiverse.internals
Title: Internal Infrastructure for R-multiverse
Description: R-multiverse requires this internal infrastructure package to
automate contribution reviews and populate universes.
Version: 1.0.9
Version: 1.0.10
License: MIT + file LICENSE
URL:
https://r-multiverse.org/multiverse.internals/,
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# multiverse.internals 1.0.10

* Allow `review_pull_request()` to get advisories and organizations if not supplied.

# multiverse.internals 1.0.9

* Use `tools::analyze_license()` to determine if a package in a registration request has an open-source license. This is much more consistent and reliable than checking a manual list of license specification strings.
Expand Down
14 changes: 12 additions & 2 deletions R/review_pull_request.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,29 @@
#' in the repo.
#' @param advisories Character vector of names of packages with advisories
#' in the R Consortium Advisory Database.
#' If `NULL`, the function reads the database.
#' @param organizations Character vector of names of GitHub organizations.
#' Pull requests from authors who are not members of at least one of
#' these organizations will be flagged for manual review.
#' If `NULL`, the function reads the list of trusted organizations.
review_pull_request <- function(
owner = "r-multiverse",
repo = "contributions",
number,
advisories = character(0L),
organizations = character(0L)
advisories = NULL,
organizations = NULL
) {
assert_character_scalar(owner, "owner must be a character string")
assert_character_scalar(repo, "repo must be a character string")
assert_positive_scalar(number, "number must be a positive integer")
if (is.null(advisories)) {
message("Skimming the R Consortium Advisory Database...")
advisories <- unique(read_advisories()$package)
}
if (is.null(organizations)) {
message("Listing trusted GitHub organizations...")
organizations <- list_organizations(owner = owner, repo = repo)
}
message("Reviewing pull request ", number)
merge <- review_pull_request_integrity(owner, repo, number, organizations) &&
review_pull_request_content(owner, repo, number, advisories)
Expand Down
10 changes: 6 additions & 4 deletions man/review_pull_request.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/testthat/test-update_status.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ test_that("update_status()", {
path_status <- tempfile()
gert::git_clone(
url = "https://github.com/r-multiverse/status",
path = path_status
path = path_status,
verbose = FALSE
)
on.exit(unlink(path_status, recursive = TRUE), add = TRUE)
stage_candidates(path_staging = path_staging)
Expand Down