archivist-github-integration {archivist.github} | R Documentation |
Archivist Integration With GitHub
Description
Set of functions to integrate archivist-package with GitHub API https://developer.github.com/v3/.
To start working with archivist.github one should run authoriseGitHub to create an
OAuth
token which is required by every function in this package.
It is possible to create new GitHub repository with an empty archivist-like Repository with createGitHubRepo function.
archive stores artifacts in the Local
Repository
and automatically pushes archived artifacts to the GitHub
Repository
with which the Local Repository
is synchronized.
cloneGitHubRepo clones GitHub Repository into the local directory.
deleteGitHubRepo can delete whole GitHub-Repository or only archivist-like Repository stored on a GitHub-Repository.
pushGitHubRepo and pullGitHubRepo synchronize Local and GitHub (remote) Repository.
Details
To use this set of functionalities, one firstly has to authorize himselft to the GitHub API.
It can be done by creating https://github.com/settings/developers
(register new application). If you do not know what should be included as callback url
, you may
use http://localhost:1410
for testing purposes.
When application is created, one will have to copy its Client ID
and
Client Secret
and authorize his github user with this application by running those commands:
-
myapp <- oauth_app("github", key = Client_ID, secret = Client_Secret)
, -
github_token <- oauth2.0_token(oauth_endpoints("github"), myapp, scope = "public_repo")
.
The scope
limits can be found here
https://developer.github.com/v3/oauth/#scopes.
Basically, this is how you grant an access to your application and give permissions.
With such a token one is authorized and can work with GitHub API and archivist
functions devoted to GitHub integration.
To perform GitHub integration operations such as push
, pull
, commit
, add
etc.
a user has to pass his GitHub user name (user.name
parameter), user email (user.email
parameter) and user password (user.password
parameter). Those parameters can be set globbaly
with aoptions("user.email", user.email)
, aoptions("user.name", user.name)
and aoptions("user.password", user.password)
.
Note
Note that global configuration of the git config
is used for initial commit.
One can later specify local configuration for the repository with config, e.g
config(repoName, user.name = "Alice", user.email = "mail_at_gmail.com")
.
Bug reports and feature requests can be sent to https://github.com/MarcinKosinski/archivist.github/issues
Author(s)
Marcin Kosinski, m.p.kosinski@gmail.com
References
More about archivist.github can be found on marcinkosinski.github.io/archivist.github/ and about archivist in posts' history on https://pbiecek.github.io/archivist/articles/posts.html
See Also
Other archivist: addHooksToPrintGitHub
Examples
## Not run:
authoriseGitHub(ClientID, ClientSecret) -> github_token
# authoriseGitHub also does: aoptions("github_token", github_token)
aoptions("user", user.name)
aoptions("password", user.password)
## here github_token is used
createGitHubRepo("Museum")
createGitHubRepo("Museum-Extras", response = TRUE)
createGitHubRepo("Gallery", readme = NULL)
createGitHubRepo("Landfill",
repoDescription = "My models and stuff")
## End(Not run)