-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #484 from r-world-devs/devel
2.1.0 release
- Loading branch information
Showing
108 changed files
with
5,713 additions
and
3,335 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
^docs$ | ||
^pkgdown$ | ||
^project_metadata.yaml | ||
^.lintr |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: [push, pull_request] | ||
|
||
name: lint | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::lintr, local::. | ||
needs: lint | ||
|
||
- name: Lint | ||
run: lintr::lint_package() | ||
shell: Rscript {0} | ||
env: | ||
LINTR_ERROR_ON_LINT: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
name: pkgdown.yaml | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
# Only restrict concurrency for non-PR jobs | ||
concurrency: | ||
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
GITLAB_PAT_PUBLIC: ${{ secrets.GITLAB_PAT}} | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::pkgdown, local::. | ||
needs: website | ||
|
||
- name: Build site | ||
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | ||
shell: Rscript {0} | ||
|
||
- name: Deploy to GitHub pages 🚀 | ||
if: github.event_name != 'pull_request' | ||
uses: JamesIves/[email protected] | ||
with: | ||
clean: false | ||
branch: gh-pages | ||
folder: docs |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
linters: linters_with_defaults( | ||
quotes_linter = NULL, | ||
line_length_linter = NULL, | ||
object_usage_linter = NULL, | ||
object_length_linter = NULL, | ||
object_name_linter = NULL, | ||
cyclocomp_linter = NULL | ||
) | ||
exclusions: list( | ||
"inst", | ||
"tests") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: GitStats | ||
Title: Get Statistics from GitHub and GitLab | ||
Version: 2.0.2 | ||
Version: 2.1.0 | ||
Authors@R: c( | ||
person(given = "Maciej", family = "Banas", email = "[email protected]", role = c("aut", "cre")), | ||
person(given = "Kamil", family = "Koziej", email = "[email protected]", role = "aut"), | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,91 @@ | ||
#' @noRd | ||
#' @description A class for methods wrapping GitHub's GraphQL API responses. | ||
EngineGraphQL <- R6::R6Class("EngineGraphQL", | ||
inherit = Engine, | ||
EngineGraphQL <- R6::R6Class( | ||
"EngineGraphQL", | ||
inherit = Engine, | ||
public = list( | ||
|
||
public = list( | ||
#' @field gql_api_url A character, url of GraphQL API. | ||
gql_api_url = NULL, | ||
|
||
#' @field gql_api_url A character, url of GraphQL API. | ||
gql_api_url = NULL, | ||
#' @field gql_query An environment for GraphQL queries. | ||
gql_query = NULL, | ||
|
||
#' @field gql_query An environment for GraphQL queries. | ||
gql_query = NULL, | ||
#' Create `EngineGraphQL` object. | ||
initialize = function(gql_api_url = NA, | ||
token = NA, | ||
scan_all = FALSE) { | ||
private$engine <- "graphql" | ||
self$gql_api_url <- gql_api_url | ||
private$token <- token | ||
private$scan_all <- scan_all | ||
}, | ||
|
||
#' Create `EngineGraphQL` object. | ||
initialize = function(gql_api_url = NA, | ||
token = NA, | ||
scan_all = FALSE) { | ||
private$engine <- "graphql" | ||
self$gql_api_url <- gql_api_url | ||
private$token <- token | ||
private$scan_all <- scan_all | ||
}, | ||
#' Wrapper of GraphQL API request and response. | ||
gql_response = function(gql_query, vars = "null") { | ||
response <- private$perform_request( | ||
gql_query = gql_query, | ||
vars = vars | ||
) | ||
response_list <- httr2::resp_body_json(response) | ||
return(response_list) | ||
}, | ||
|
||
#' Wrapper of GraphQL API request and response. | ||
gql_response = function(gql_query, vars = "null") { | ||
response <- private$perform_request( | ||
gql_query = gql_query, | ||
vars = vars | ||
) | ||
response_list <- httr2::resp_body_json(response) | ||
return(response_list) | ||
}, | ||
# A method to pull information on user. | ||
get_user = function(username) { | ||
response <- tryCatch( | ||
{ | ||
self$gql_response( | ||
gql_query = self$gql_query$user(), | ||
vars = list("user" = username) | ||
) | ||
}, | ||
error = function(e) { | ||
NULL | ||
} | ||
) | ||
return(response) | ||
} | ||
), | ||
private = list( | ||
|
||
# A method to pull information on user. | ||
pull_user = function(username) { | ||
response <- tryCatch({ | ||
self$gql_response( | ||
gql_query = self$gql_query$user(), | ||
vars = list("user" = username) | ||
) | ||
}, error = function(e) { | ||
NULL | ||
}) | ||
return(response) | ||
} | ||
), | ||
private = list( | ||
|
||
# GraphQL method for pulling response from API | ||
perform_request = function(gql_query, vars) { | ||
response <- httr2::request(paste0(self$gql_api_url, "?")) %>% | ||
httr2::req_headers("Authorization" = paste0("Bearer ", private$token)) %>% | ||
httr2::req_body_json(list(query = gql_query, variables = vars)) %>% | ||
httr2::req_retry( | ||
is_transient = ~ httr2::resp_status(.x) %in% c(400, 500, 502), | ||
max_seconds = 60 | ||
) %>% | ||
httr2::req_perform() | ||
return(response) | ||
} | ||
) | ||
# GraphQL method for pulling response from API | ||
perform_request = function(gql_query, vars) { | ||
response <- httr2::request(paste0(self$gql_api_url, "?")) %>% | ||
httr2::req_headers("Authorization" = paste0("Bearer ", private$token)) %>% | ||
httr2::req_body_json(list(query = gql_query, variables = vars)) %>% | ||
httr2::req_retry( | ||
is_transient = ~ httr2::resp_status(.x) %in% c(400, 502), | ||
max_seconds = 30 | ||
) %>% | ||
httr2::req_perform() | ||
return(response) | ||
}, | ||
is_query_error = function(response) { | ||
check <- FALSE | ||
if (length(response) > 0) { | ||
check <- names(response) == "errors" | ||
} | ||
return(check) | ||
}, | ||
filter_files_by_pattern = function(files_structure, pattern) { | ||
files_structure[grepl(pattern, files_structure)] | ||
}, | ||
get_path_from_files_structure = function(host_files_structure, | ||
only_text_files, | ||
org, | ||
repo = NULL) { | ||
if (is.null(repo)) { | ||
file_path <- host_files_structure[[org]] %>% | ||
unlist(use.names = FALSE) %>% | ||
unique() | ||
} else { | ||
file_path <- host_files_structure[[org]][[repo]] | ||
} | ||
if (only_text_files) { | ||
file_path <- file_path[!grepl(non_text_files_pattern, file_path)] | ||
} | ||
return(file_path) | ||
} | ||
) | ||
) |
Oops, something went wrong.