Minuscule client for the Github API
This library just provides the HTTP verbs. Instead of wrapping every resource, I recommend https://developer.github.com/v3.
$ git config --global github.user <username> $ emacs ~/.authinfo.gpg
# -*- epa-file-encrypt-to: ("A.U.Thor@example.com") -*- machine api.github.com login <login> password <token>
To acquire a token, go to https://github.com/settings/tokens. Note
that currently the same token is shared by all Emacs packages that
Getting details about a repository:
Listing names of all repositories of a user:
(--keep (cdr (assq 'name it)) (let ((ghub-unpaginate t)) (ghub-get "/users/tarsius/repos")))
Making an unauthenticated request:
(let ((ghub-authenticate nil)) (ghub-get "/orgs/magit/repos"))
Making a request using basic authentication:
(let ((ghub-authenticate 'basic)) (ghub-get "/orgs/magit/repos"))
Github Enterprise support
$ cd /path/to/repository $ git config eg_example_com.user employee $ emacs ~/.authinfo.gpg
# -*- epa-file-encrypt-to: ("email@example.com") -*- machine gh.example.com/api/v3 login employee password <token>
Note that unlike for Github.com, which uses
github.user, the Git
variable used to store the username for an Enterprise instance is
HOST.user, where HOST is the host part of the
dots replaced with underscores.
Making a request:
(let ((ghub-base-url "https://example.com/api/v3")) (ghub-get "/users/employee/repos"))
If you like this, then you might never-the-less prefer
a thick GitHub API client built on `ghub.el'.
If you like this, then you might also like
glab.el; a minuscule
client for the Gitlab API. See https://gitlab.com/tarsius/glab.
If you don't like this, then you might instead like
gh.el; a big
client for the Github API. See https://github.com/sigma/gh.el.