Title: | Easier to Use API Wrapper for 'GitHub' |
---|---|
Description: | This is a 'GitHub' API wrapper for R. <https://docs.github.com/en/rest> It uses the 'gh' package but has things wrapped up for convenient use cases. |
Authors: | Candace Savonen [cre, aut] |
Maintainer: | Candace Savonen <[email protected]> |
License: | GPL-3 |
Version: | 0.9.1 |
Built: | 2025-03-19 05:32:26 UTC |
Source: | https://github.com/fhdsl/githubr |
Given an a user name, accept all invites
accept_all_invites(git_pat = NULL, verbose = TRUE)
accept_all_invites(git_pat = NULL, verbose = TRUE)
git_pat |
Whatever credentials are given are where invites will be accepted from. If none is supplied, then this will attempt to grab from a git pat set in the environment with usethis::create_github_token(). |
verbose |
TRUE/FALSE do you want more progress messages? |
a response from GitHub's API
## Not run: # First, set up your GitHub credentials using `usethis::gitcreds_set()`. # Get a GitHub personal access token (PAT) usethis::create_github_token() # Give this token to `gitcreds_set()` gitcreds::gitcreds_set() # All invites that have been sent to the PAT you have provided you will be accepted accept_all_invites() ## End(Not run)
## Not run: # First, set up your GitHub credentials using `usethis::gitcreds_set()`. # Get a GitHub personal access token (PAT) usethis::create_github_token() # Give this token to `gitcreds_set()` gitcreds::gitcreds_set() # All invites that have been sent to the PAT you have provided you will be accepted accept_all_invites() ## End(Not run)
Given a repository name, check with git ls-remote whether the repository exists and return a TRUE/FALSE
check_git_repo( repo_name, git_pat = NULL, silent = TRUE, return_repo = FALSE, verbose = TRUE )
check_git_repo( repo_name, git_pat = NULL, silent = TRUE, return_repo = FALSE, verbose = TRUE )
repo_name |
the name of the repository, e.g. jhudsl/OTTR_Template |
git_pat |
A personal access token from GitHub. Only necessary if the repository being checked is a private repository. |
silent |
TRUE/FALSE of whether the warning from the git ls-remote command should be echoed back if it does fail. |
return_repo |
TRUE/FALSE of whether or not the output from git ls-remote should be saved to a file (if the repo exists) |
verbose |
TRUE/FALSE do you want more progress messages? |
A TRUE/FALSE whether or not the repository exists. Optionally the output from git ls-remote if return_repo = TRUE.
## Not run: exists <- check_git_repo("jhudsl/OTTR_Template") if (exists) message("Yup, this repo exists") ## End(Not run)
## Not run: exists <- check_git_repo("jhudsl/OTTR_Template") if (exists) message("Yup, this repo exists") ## End(Not run)
Handle things whether or not a GitHub PAT is supplied.
get_git_auth( git_pat = NULL, git_username = "PersonalAccessToken", quiet = FALSE )
get_git_auth( git_pat = NULL, git_username = "PersonalAccessToken", quiet = FALSE )
git_pat |
If private repositories are to be retrieved, a github personal access token needs to be supplied. If none is supplied, then this will attempt to grab from a git pat set in the environment with usethis::create_github_token(). |
git_username |
Optional, can include username for credentials. |
quiet |
Use TRUE if you don't want the warning about no GitHub credentials. |
Authorization argument to supply to curl OR a blank string if no authorization is found or supplied.
Given a repository name, get a list of issues.
get_issues(repo_name, how_many = "all", git_pat = NULL, verbose = TRUE)
get_issues(repo_name, how_many = "all", git_pat = NULL, verbose = TRUE)
repo_name |
the name of the repository to retrieve issues from, e.g. jhudsl/OTTR_Template |
how_many |
put the number of how many you would like returned. If all, put "all". By default will return all issues. |
git_pat |
A personal access token from GitHub. Only necessary if the repository being checked is a private repository. |
verbose |
TRUE/FALSE do you want more progress messages? |
A data frame that contains information about the issues from the given repository
## Not run: # First, set up your GitHub credentials using `usethis::gitcreds_set()`. # Get a GitHub personal access token (PAT) usethis::create_github_token() # Give this token to `gitcreds_set()` gitcreds::gitcreds_set() # Now you can retrieve issues issues_df <- get_issues("jhudsl/OTTR_Template") # Alternatively, you can supply the GitHub PAT directly # to the function to avoid doing the steps above. issues_df <- get_issues("jhudsl/OTTR_Template", git_pat = "gh_somepersonalaccesstokenhere") ## End(Not run)
## Not run: # First, set up your GitHub credentials using `usethis::gitcreds_set()`. # Get a GitHub personal access token (PAT) usethis::create_github_token() # Give this token to `gitcreds_set()` gitcreds::gitcreds_set() # Now you can retrieve issues issues_df <- get_issues("jhudsl/OTTR_Template") # Alternatively, you can supply the GitHub PAT directly # to the function to avoid doing the steps above. issues_df <- get_issues("jhudsl/OTTR_Template", git_pat = "gh_somepersonalaccesstokenhere") ## End(Not run)
Given a username or organization, retrieve all the repos
get_repos(owner, how_many = "all", git_pat = NULL, verbose = TRUE)
get_repos(owner, how_many = "all", git_pat = NULL, verbose = TRUE)
owner |
the name of the organization or user to retrieve a list of repos from. E.g. fhdsl |
how_many |
put the number of how many you would like returned. If all, put "all". By default will return all issues. |
git_pat |
A personal access token from GitHub. Only necessary if the repository being checked is a private repository. |
verbose |
TRUE/FALSE do you want more progress messages? |
A data frame that contains information about the issues from the given repository
## Not run: # First, set up your GitHub credentials using `usethis::gitcreds_set()`. # Get a GitHub personal access token (PAT) usethis::create_github_token() # Give this token to `gitcreds_set()` gitcreds::gitcreds_set() # Now you can retrieve the repositories repos_df <- get_repos("fhdsl") # Alternatively, you can supply the GitHub PAT directly # to the function to avoid doing the steps above. repos_df <- get_repos("fhdsl", git_pat = "gh_somepersonalaccesstokenhere") ## End(Not run)
## Not run: # First, set up your GitHub credentials using `usethis::gitcreds_set()`. # Get a GitHub personal access token (PAT) usethis::create_github_token() # Give this token to `gitcreds_set()` gitcreds::gitcreds_set() # Now you can retrieve the repositories repos_df <- get_repos("fhdsl") # Alternatively, you can supply the GitHub PAT directly # to the function to avoid doing the steps above. repos_df <- get_repos("fhdsl", git_pat = "gh_somepersonalaccesstokenhere") ## End(Not run)