Skip to content

Commit 704c4e6

Browse files
authored
Merge pull request #81 from wlandau/main
Allow review_pull_request() to get advisories and organizations if no…
2 parents f2bda35 + 5530e04 commit 704c4e6

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package: multiverse.internals
22
Title: Internal Infrastructure for R-multiverse
33
Description: R-multiverse requires this internal infrastructure package to
44
automate contribution reviews and populate universes.
5-
Version: 1.0.9
5+
Version: 1.0.10
66
License: MIT + file LICENSE
77
URL:
88
https://r-multiverse.org/multiverse.internals/,

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# multiverse.internals 1.0.10
2+
3+
* Allow `review_pull_request()` to get advisories and organizations if not supplied.
4+
15
# multiverse.internals 1.0.9
26

37
* 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.

R/review_pull_request.R

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,29 @@
99
#' in the repo.
1010
#' @param advisories Character vector of names of packages with advisories
1111
#' in the R Consortium Advisory Database.
12+
#' If `NULL`, the function reads the database.
1213
#' @param organizations Character vector of names of GitHub organizations.
1314
#' Pull requests from authors who are not members of at least one of
1415
#' these organizations will be flagged for manual review.
16+
#' If `NULL`, the function reads the list of trusted organizations.
1517
review_pull_request <- function(
1618
owner = "r-multiverse",
1719
repo = "contributions",
1820
number,
19-
advisories = character(0L),
20-
organizations = character(0L)
21+
advisories = NULL,
22+
organizations = NULL
2123
) {
2224
assert_character_scalar(owner, "owner must be a character string")
2325
assert_character_scalar(repo, "repo must be a character string")
2426
assert_positive_scalar(number, "number must be a positive integer")
27+
if (is.null(advisories)) {
28+
message("Skimming the R Consortium Advisory Database...")
29+
advisories <- unique(read_advisories()$package)
30+
}
31+
if (is.null(organizations)) {
32+
message("Listing trusted GitHub organizations...")
33+
organizations <- list_organizations(owner = owner, repo = repo)
34+
}
2535
message("Reviewing pull request ", number)
2636
merge <- review_pull_request_integrity(owner, repo, number, organizations) &&
2737
review_pull_request_content(owner, repo, number, advisories)

man/review_pull_request.Rd

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-update_status.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ test_that("update_status()", {
3131
path_status <- tempfile()
3232
gert::git_clone(
3333
url = "https://github.com/r-multiverse/status",
34-
path = path_status
34+
path = path_status,
35+
verbose = FALSE
3536
)
3637
on.exit(unlink(path_status, recursive = TRUE), add = TRUE)
3738
stage_candidates(path_staging = path_staging)

0 commit comments

Comments
 (0)