Skip to content

Commit

Permalink
Creating "workflow" vignette and updating Readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
maciekbanas committed Sep 22, 2023
1 parent 7e45da1 commit 78525ef
Show file tree
Hide file tree
Showing 4 changed files with 282 additions and 387 deletions.
140 changes: 11 additions & 129 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,148 +21,30 @@ knitr::opts_chunk$set(
[![Codecov test coverage](https://codecov.io/gh/r-world-devs/GitStats/branch/devel/graph/badge.svg)](https://app.codecov.io/gh/r-world-devs/GitStats?branch=devel)
<!-- badges: end -->

The goal of GitStats is to search through multiple GitHub and GitLab platforms for different statistics either by owners/groups of repositories, team members or searched code phrases.

For the time being GitStats supports connections to public GitHub, enterprise GitHub and GitLab.
The goal of GitStats is to pull git statistics in a uniform way from different Git platforms (GitHub and GitLab for the time-being).

## Installation

```r
devtools::install_github("r-world-devs/GitStats")
```

## Getting started
## Setting up your tokens

Please remember to have your access tokens stored as environment variables: `GITHUB_PAT` for access to GitHub API and `GITLAB_PAT` for GitLab API.

You can start by creating your `GitStats` object, where you will hold information on your multiple connections.

```{r}
library(GitStats)
git_stats <- create_gitstats() %>%
set_host(
api_url = "https://api.github.com",
orgs = c("r-world-devs", "openpharma"),
token = Sys.getenv("GITHUB_PAT")
) %>%
set_host(
api_url = "https://gitlab.com/api/v4",
orgs = c("mbtests"),
token = Sys.getenv("GITLAB_PAT_PUBLIC")
)
```

By default your search preferences are set to `organizations` (`org`).

```{r}
git_stats
pull_repos(
git_stats
)
pull_commits(
git_stats,
date_from = "2023-01-01",
date_until = "2023-03-31"
)
```

Finally you can retrieve your repos to separate object.

```{r}
repos_dt <- get_repos(git_stats)
commits_dt <- get_commits(git_stats)
```

## Set

You can setup your search preferences, either to `org`, `team` or `phrase`.

### Team

If you with to setup your search parameter to team, add your team members first:

```{r}
git_stats %>%
set_team_member("Kamil Wais", "kalimu") %>%
set_team_member("Krystian Igras", "krystian8207") %>%
set_team_member("Karolina Marcinkowska", "marcinkowskak") %>%
set_team_member("Kamil Koziej", "Cotau") %>%
set_team_member("Maciej Banaś", "maciekbanas") %>%
set_params(
search_param = "team",
team_name = "RWD"
) %>%
pull_repos()
pull_commits(
gitstats_obj = git_stats,
date_from = "2023-01-01",
date_until = "2023-03-31"
)
```

### Phrase

With `GitStats` you can look for the repos with a certain phrase in code blobs.

```{r}
set_params(
gitstats_obj = git_stats,
search_param = "phrase",
phrase = "shiny"
) %>%
pull_repos()
```

### Language

You can define a programming language in your settings.

```{r}
set_params(
gitstats_obj = git_stats,
search_param = "org",
language = "JavaScript"
) %>%
pull_repos()
```

You can always get back to All languages.
## GitStats workflow

```{r}
reset_language(git_stats)
```

## Users

You can retrieve data about users with GitStats.

```{r}
pull_users(
gitstats_obj = git_stats,
users = c("maciekbanas", "kalimu", "Cotau", "marcinkowskak", "@krystian8207")
)
```

## Reset your settings

If you wish to get back to default settings, run:

```{r}
reset(git_stats)
```
On how to use GitStats, refer to the [documentation](placeholder for a link to docs).

### Acknowledgement
## Acknowledgement

Special thanks to:

- Kamil Koziej @Cotau - for reviewing permanently my pull requests and suggesting more efficient solutions,
- Karolina Marcinkowska @marcinkowskak - for substantial improvements on plots,
- Krystian Igraś @krystian8207 - for the major review of GitStats and,
- Matt Secrest @mattsecrest - for making use of your scripts to apply search feature,
- Kamil Wais @kalimu, Adam Foryś @galachad - for your guidelines at the very beginning of the project.
- [Kamil Koziej](https://github.com/Cotau) - for reviewing permanently my pull requests and suggesting more efficient solutions,
- [Karolina Marcinkowska](https://github.com/marcinkowskak) - for substantial improvements on plots,
- [Krystian Igras](https://github.com/krystian8207) - for the major review of GitStats,
- [Matt Secrest](https://github.com/mattsecrest) - for making use of your scripts to apply search feature,
- [Kamil Wais](https://github.com/kalimu), [Adam Forys](https://github.com/galachad) - for your guidelines at the very beginning of the project,
- [James Black](https://github.com/epijim) - for giving a kick-off for this project and an inspiration from [GithubMetrics](https://github.com/openpharma/GithubMetrics).

Loading

0 comments on commit 78525ef

Please sign in to comment.