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

Require that commits come from the GitHub web UI #32

Merged
merged 2 commits into from
Jul 19, 2024
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 internal infrastructure
package to automate contribution reviews and populate universes.
Version: 0.2.7
Version: 0.2.8
License: MIT + file LICENSE
URL: https://github.com/r-multiverse/multiverse.internals
BugReports: https://github.com/r-multiverse/multiverse.internals/issues
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 0.2.8

* Only merge contributions created through the web interface.

# multiverse.internals 0.2.7

* Exclude superfluous fields from `update_production()` `packages.json`.
Expand Down
24 changes: 12 additions & 12 deletions R/review_pull_request.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ review_pull_request <- function(
repo = "contributions",
number
) {
assert_character_scalar(owner)
assert_character_scalar(repo)
assert_positive_scalar(number)
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")
message("Reviewing pull request ", number)
merge <- review_pull_request_integrity(owner, repo, number) &&
review_pull_request_content(owner, repo, number)
Expand All @@ -48,7 +48,10 @@ review_pull_request_integrity <- function(owner, repo, number) {
repo = repo,
sha = pull$head$sha
)
if (!isTRUE(commit$verification$verified)) {
from_web_ui <- isTRUE(commit$verification$verified) &&
identical(commit$committer$name, "GitHub") &&
identical(commit$committer$email, "noreply@github.com")
if (!from_web_ui) {
pull_request_defer(
owner = owner,
repo = repo,
Expand All @@ -58,14 +61,11 @@ review_pull_request_integrity <- function(owner, repo, number) {
pull$head$sha,
") of pull request ",
number,
" is unverified. For security reasons, ",
"R-multiverse only merges pull requests with ",
"verified commits. You can create a verified commit ",
"by contributing through the point-and-click web interface ",
"as described at https://r-multiverse.org/contributors.html. ",
"For more information on commit signature verification, please see ",
"https://docs.github.com/en/authentication/",
"managing-commit-signature-verification"
" was not created using the point-and-click ",
"web user interface on GitHub.com. ",
"For security reasons, the R-multiverse bot only ",
"merges commits created manually through a web browser ",
"as described at https://r-multiverse.org/contributors.html."
)
)
return(FALSE)
Expand Down
4 changes: 2 additions & 2 deletions R/review_pull_requests.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ review_pull_requests <- function(
owner = "r-multiverse",
repo = "contributions"
) {
assert_character_scalar(owner)
assert_character_scalar(repo)
assert_character_scalar(owner, "owner must be a character string")
assert_character_scalar(repo, "repo must be a character string")
message("Listing pull requests...")
pull_requests <- gh::gh(
"/repos/:owner/:repo/pulls",
Expand Down
Loading