Skip to content

Commit

Permalink
Merge pull request #518 from r-world-devs/devel
Browse files Browse the repository at this point in the history
2.1.1 patch release
  • Loading branch information
maciekbanas authored Oct 29, 2024
2 parents 08a7d85 + a12bf97 commit 45a26d6
Show file tree
Hide file tree
Showing 93 changed files with 4,260 additions and 1,898 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
^pkgdown$
^project_metadata.yaml
^.lintr
^CRAN-SUBMISSION$
^cran-comments\.md$
^vignettes/get_and_store_data\.Rmd$
^vignettes/get_files\.Rmd$
6 changes: 3 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
branches: [devel, test, master]

name: R-CMD-check
name: 👮 R-CMD-check

jobs:
R-CMD-check:
Expand All @@ -23,8 +23,8 @@ jobs:
- {os: ubuntu-latest, r: 'release'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
GITLAB_PAT_PUBLIC: ${{ secrets.GITLAB_PAT}}
GITHUB_PAT: ${{ secrets.TEST_GITHUB_PAT }}
GITLAB_PAT_PUBLIC: ${{ secrets.GITLAB_PAT }}
R_KEEP_PKG_SOURCE: yes
USE_RENV: "FALSE"

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# 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

name: lint
on:
push:
branches: [master]
pull_request:
branches: [devel, test, master]

jobs:
lint:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
types: [published]
workflow_dispatch:

name: pkgdown.yaml
name: 🌐 Build site

permissions: read-all

Expand All @@ -20,8 +20,8 @@ jobs:
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
GITLAB_PAT_PUBLIC: ${{ secrets.GITLAB_PAT}}
GITHUB_PAT: ${{ secrets.TEST_GITHUB_PAT }}
GITLAB_PAT_PUBLIC: ${{ secrets.GITLAB_PAT }}
permissions:
contents: write
steps:
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# 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: [master]
pull_request:
branches: [devel, test, master]

name: test-coverage
name: 🧪 Test coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
GITLAB_PAT_PUBLIC: ${{ secrets.GITLAB_PAT}}
GITHUB_PAT: ${{ secrets.TEST_GITHUB_PAT }}
GITLAB_PAT_PUBLIC: ${{ secrets.GITLAB_PAT }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
USE_RENV: "FALSE"

steps:
Expand All @@ -28,7 +27,7 @@ jobs:
extra-packages: any::covr
needs: coverage

- name: Test coverage
- name: Code coverage
run: |
covr::codecov(
quiet = FALSE,
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: ⬆️ Check Version Bump

on:
pull_request:
branches: [devel, test, master]

jobs:
check-version:
runs-on: ubuntu-latest

steps:
- name: Checkout source branch
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
path: source

- name: Checkout target branch
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.base.sha }}
path: target

- name: Compare versions
id: compare_versions
run: |
SOURCE_VERSION=$(awk '/^Version:/ { print $2 }' source/DESCRIPTION)
TARGET_VERSION=$(awk '/^Version:/ { print $2 }' target/DESCRIPTION)
echo "Source package version: $SOURCE_VERSION"
echo "Target package version: $TARGET_VERSION"
if [ "$SOURCE_VERSION" == "$TARGET_VERSION" ]; then
echo "Versions are identical"
echo "::set-output name=versions_identical::true"
else
echo "Versions differ"
echo "::set-output name=versions_identical::false"
fi
- name: Fail if versions are identical
if: steps.compare_versions.outputs.versions_identical == 'true'
run: |
echo "The package versions are identical between the source and target branches."
exit 1
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Package: GitStats
Title: Get Statistics from GitHub and GitLab
Version: 2.1.0
Title: Get Statistics from 'GitHub' and 'GitLab'
Version: 2.1.1
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"),
person(given = "Karolina", family = "Marcinkowska", email = "[email protected]", role = "aut"),
person(given = "Matt", family = "Secrest", email = "[email protected]", role = "aut")
)
Description: Obtain statistics in a standardized way from multiple Git services: GitHub and GitLab for the time-being.
Its main purpose is to help teams, whose activities are spread across multiple git platforms, get their repository
metadata in a standardized way from all these platforms.
Description: Obtain statistics in a standardized way from multiple 'Git' services: 'GitHub' and 'GitLab' for the time-being.
Its main purpose is to help teams, whose activities are spread across multiple git platforms, get their repository metadata
in a standardized way from all these platforms.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE, r6 = TRUE)
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export(get_files_structure)
export(get_release_logs)
export(get_repos)
export(get_repos_urls)
export(get_storage)
export(get_users)
export(set_github_host)
export(set_gitlab_host)
Expand Down
24 changes: 23 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# GitStats 2.1.1

This is a patch release which introduces some improvements in `get_R_package_usage()` on speed and possibility to pull at once data on multiple R packages, new `get_storage()` function and some fixes for checking token scopes and setting hosts.

## Features:

- Optimized `get_R_package_usage()` function:
- it is now possible to pass a vector of packages names (new `packages` parameter replacing old `package_name`) ([#494](https://github.com/r-world-devs/GitStats/issues/494)),
- on the other hand, output of the function has been limited to contain only most necessary data (removing all repository stats), making thus process of obtaining package usage faster ([#474](https://github.com/r-world-devs/GitStats/issues/474)).
- new `split_output` parameter has been added - when set to `TRUE` a `list` with `tibbles` (every element of the `list` for every package) instead of one `tibble` is returned.
- Added possibility to get repositories for individual users with `get_repos()` ([#492](https://github.com/r-world-devs/GitStats/issues/492)). Earlier this was only possible for GitHub organizations and GitLab groups.
- Added new `get_storage()` function to retrieve data from `GitStats` object - whole or particular datasets (e.g. `commits`, `repositories` or `R_package_usage`) ([#509](https://github.com/r-world-devs/GitStats/issues/509)).

## Fixes:

- Fixed getting large search responses for GitHub ([#491](https://github.com/r-world-devs/GitStats/issues/491)).
- Fixed checking token scopes ([#501](https://github.com/r-world-devs/GitStats/issues/501)). If token scopes are insufficient error is returned and `GitHost` is not passed to `GitStats`. This also applies to situation when `GitStats` looks for default tokens (not defined by user). Earlier, if tests for token failed, an empty token was passed and `GitStats` was created, which was misleading for the user.
- It is now possible to pass public GitHub host name (`github.com` or `https://github.com`) to `set_github_host()` ([#475](https://github.com/r-world-devs/GitStats/issues/475)).
- It is also possible to pass hosts in more flexible way than before (e.g. `{host_url}`, `http://{host_url}` or `https://{host_url}`) to `host` parameter in `set_*_host() function ([#399](https://github.com/r-world-devs/GitStats/issues/399)).

# GitStats 2.1.0

This minor release comes up with new `get_files_structure()` function and adjustments to `get_files_content()` so user can pull custom (by defining pattern of files and depth of directories) files tree from repository and pull their content.

## New features:

- Added new `get_files_structure()` function to pull files structure for a given repository with possibility to control level of directories (`depth` parameter) and to limit output to files matching regex argument passed to `pattern` parameter ([#338](https://github.com/r-world-devs/GitStats/issues/338)). Together with that, `get_files()` function was renamed to `get_files_content()` to better reflect its purpose.
Expand Down Expand Up @@ -53,7 +75,7 @@ This is a major release with general changes in workflow (simplifying it), chang

## Simplifying workflow:

- GitStats workflow is now simplified. To pull data on `repositories`, `commits`, `R_package_usage` or other you should use directly corresponding `get_*()` functions instead of `pull_*()` which are deprecated. These `get_*()` functions pull data from API, parse it into table, add some goodies (additional columns) if needed and return table instead of `GitStats` object, which in our opinion is more intuitive and user-friendly ([#345]((https://github.com/r-world-devs/GitStats/issues/345))). That means you do not need to run in pipe two or three additional function calls as before, e.g. `pull_repos(gitstats_object) %>% get_repos() %>% get_repos_stats()`, but you just run
- GitStats workflow is now simplified. To pull data on `repositories`, `commits`, `R_package_usage` or other you should use directly corresponding `get_*()` functions instead of `pull_*()` which are deprecated. These `get_*()` functions pull data from API, parse it into table, add some goodies (additional columns) if needed and return table instead of `GitStats` object, which in our opinion is more intuitive and user-friendly ([#345](https://github.com/r-world-devs/GitStats/issues/345)). That means you do not need to run in pipe two or three additional function calls as before, e.g. `pull_repos(gitstats_object) %>% get_repos() %>% get_repos_stats()`, but you just run
`get_repos(gitstats_object)` to get data you need.
- Moreover, if you run for the second time `get_*()` function `GitStats` will pull the data from its storage and not from API as for the first time, unless you change parameters for the function (e.g. starting date with `since` in `get_commits()`) or change directly the `cache` parameter in the function. ([#333](https://github.com/r-world-devs/GitStats/issues/333))
- `pull_repos_contributors()` as a separate function is deprecated. The parameter `add_contributors` is now set by default to `TRUE` in `get_repos()` which seems more reasonable as user gets all the data.
Expand Down
4 changes: 2 additions & 2 deletions R/EngineGraphQL.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ EngineGraphQL <- R6::R6Class(
private = list(

# GraphQL method for pulling response from API
perform_request = function(gql_query, vars) {
perform_request = function(gql_query, vars, token = private$token) {
response <- httr2::request(paste0(self$gql_api_url, "?")) %>%
httr2::req_headers("Authorization" = paste0("Bearer ", private$token)) %>%
httr2::req_headers("Authorization" = paste0("Bearer ", token)) %>%
httr2::req_body_json(list(query = gql_query, variables = vars)) %>%
httr2::req_retry(
is_transient = ~ httr2::resp_status(.x) %in% c(400, 502),
Expand Down
Loading

0 comments on commit 45a26d6

Please sign in to comment.