Skip to content

Commit

Permalink
Merge branch 'main' into fix/36
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge authored May 15, 2024
2 parents 0709e4b + 0d98aa8 commit 373d29d
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 19 deletions.
19 changes: 11 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# R specific hooks: https://github.com/lorenzwalthert/precommit
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.3.2.9021
hooks:
rev: v0.4.2
hooks:
- id: style-files
args: [--style_pkg=spaceout, --style_fun=spaceout_style]
args: [--style_pkg=spaceout, --style_fun=spaceout_style]
additional_dependencies:
- ropensci-review-tools/spaceout
# - id: roxygenize
- ropensci-review-tools/spaceout
# - id: roxygenize
# codemeta must be above use-tidy-description when both are used
- id: codemeta-description-updated
# - id: codemeta-description-updated
- id: use-tidy-description
- id: spell-check
exclude: >
Expand Down Expand Up @@ -46,10 +46,12 @@ repos:
- id: readme-rmd-rendered
- id: parsable-R
- id: no-browser-statement
- id: no-print-statement
- id: no-debug-statement
- id: deps-in-desc
# - id: pkgdown
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-added-large-files
args: ['--maxkb=200']
Expand All @@ -60,7 +62,7 @@ repos:
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
rev: v1.6.1
hooks:
# Only reuiqred when https://pre-commit.ci is used for config validation
# Only required when https://pre-commit.ci is used for config validation
- id: check-pre-commit-ci-config
- repo: local
hooks:
Expand All @@ -77,3 +79,4 @@ repos:

ci:
autoupdate_schedule: monthly
# skip: [pkgdown]
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: allcontributors
Title: Acknowledge all Contributors to a Project
Version: 0.1.1.001
Version: 0.1.1.007
Authors@R:
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"))
Description: Acknowledge all contributors to a project via a single
Expand Down Expand Up @@ -30,4 +30,4 @@ VignetteBuilder:
Encoding: UTF-8
Language: en-GB
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Development
<<<<<<< fix/36 -- Incoming Change

## Minor changes

Expand All @@ -7,9 +8,18 @@
---

# v 0.1.1
=======
>>>>>>> main -- Current Change
## Minor changes

- Expose `check_urls' parameter in main `add_contributors` function, to allow that to be switched off (thanks to @sbfnk via #38).
- Add error handling to the URL checking function so failures do not cause function errors (also thanks to @sbfnk via #38).

---

# v 0.1.1

- Fix bug in issue contributors when github account no longer exists

---
Expand Down
11 changes: 8 additions & 3 deletions R/add-contributors.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
#' \item{3} "text" for a single line of text containing comma-separated github
#' user names linked to issue contributions.
#' }
#' @param check_urls If `TRUE` (default), GitHub URLs of all contributors are
#' checked to ensure they are still valid. (This is generally the most
#' time-consuming stage, so set to 'FALSE' if you are sure all URLs are valid.)
#' @param open_issue If `TRUE`, open or edit an issue on github in order to
#' notify all contributors that they've been added to your `README` (see Note).
#' @param force_update If `TRUE`, update the specified files even if
Expand Down Expand Up @@ -78,6 +81,7 @@ add_contributors <- function (repo = ".",
"Issue Contributors"
),
format = "grid",
check_urls = TRUE,
alphabetical = FALSE,
open_issue = FALSE,
force_update = FALSE) {
Expand Down Expand Up @@ -117,6 +121,7 @@ add_contributors <- function (repo = ".",
exclude_issues = exclude_issues,
exclude_not_planned = exclude_not_planned,
alphabetical = alphabetical,
check_urls = check_urls,
quiet = FALSE
)

Expand Down Expand Up @@ -163,9 +168,9 @@ get_org_repo <- function (repo) {
stop ("Repository must have github remote")
}

parsed_remote <- parse_github_remotes(remote)
org <- parsed_remote[["repo_owner"]]
repo <- parsed_remote[["repo_name"]]
parsed_remote <- parse_github_remotes (remote)
org <- parsed_remote [["repo_owner"]]
repo <- parsed_remote [["repo_name"]]

list (
org = org,
Expand Down
3 changes: 0 additions & 3 deletions R/github.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#' @param org Github organisation name for repository
#' @param repo Repository within `org` for which contributors are to be
#' extracted
#' @param check_urls If `TRUE` (default), GitHub URLs of all contributors are
#' checked to ensure they are still valid. (This is generally the most
#' time-consuming stage, so set to 'FALSE' if you are sure all URLs are valid.)
#' @param quiet If `FALSE`, display progress information on screen.
#' @inheritParams add_contributors
#'
Expand Down
29 changes: 27 additions & 2 deletions R/urlcheck.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,32 @@ check_github_urls <- function (ctbs, quiet = FALSE) {
pool = pool
)
}
curl::multi_run (pool = pool)
chk <- tryCatch (
curl::multi_run (pool = pool),
error = function (e) NULL
)
# Retry request on fail:
if (is.null (chk)) {
n_retries <- 3L
n_actual <- 1L
while (n_actual <= n_retries && is.null (chk)) {
Sys.sleep (1)
chk <- tryCatch (
curl::multi_run (pool = pool),
error = function (e) NULL
)
n_actual <- n_actual + 1
}
}
if (is.null (chk)) {
if (!quiet) {
message (
"\r", cli::col_green (cli::symbol$cross),
" Checking GitHub URLs failed; contributors will be added regardless"
)
}
return (ctbs)
}

if (!quiet) {
message (
Expand All @@ -72,7 +97,7 @@ check_github_urls <- function (ctbs, quiet = FALSE) {
for (i in seq_along (out)) {
if (inherits (hs [[i]], "error")) {
out [[i]] <- -1L
} else {
} else if ("status_code" %in% names (hs [[i]])) {
out [[i]] <- hs [[i]]$status_code
}
}
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/ropenscilabs/allcontributors",
"issueTracker": "https://github.com/ropenscilabs/allcontributors/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.1.001",
"version": "0.1.1.007",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
5 changes: 5 additions & 0 deletions man/add_contributors.Rd

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

0 comments on commit 373d29d

Please sign in to comment.