Crate github_release_check
source ·Expand description
Retrieve releases versions of a repository from GitHub.
Two functions are exposed by this crate: one to get the latest (Semantic Versioned) version, and
another to get all of the release versions (as String
s).
This crate works for public and private GitHub repositories on public GitHub or GitHub enterprise when supplied with a valid access token for that repository / environment.
The simplest use case is a public repository on github.com:
use github_release_check::GitHub;
let github = GitHub::new().unwrap();
let versions = github.get_all_versions("celeo/github_release_check").unwrap();
If you want to access a private repository on github.com, you’ll need an access token for a user who can view that repository:
use github_release_check::{GitHub, DEFAULT_API_ROOT};
let github = GitHub::from_custom(DEFAULT_API_ROOT, "your-access-token").unwrap();
let versions = github.get_all_versions("you/private-repo").unwrap();
If you are using a private GitHub enterprise environment:
use github_release_check::GitHub;
let github = GitHub::from_custom("https://github.your_domain.com/api/v3/", "your-access-token").unwrap();
let versions = github.get_all_versions("you/private-repo").unwrap();
Of course, handling these Result
s with something other than just unwrapping them is a good idea.
If you wish to gain more information on each release, use the query
function:
use github_release_check::GitHub;
let github = GitHub::new().unwrap();
let versions = github.query("celeo/github_release_check").unwrap();