Function check_github

Source
pub fn check_github(
    name: &str,
    user: &str,
    current_version: &str,
) -> Result<UpdateInfo>
Expand description

Checks for updates on GitHub for the specified repository.

This function queries the GitHub API to check if a newer version of the specified repository is available.

§Arguments

  • name - The name of the repository to check
  • user - The GitHub username or organization that owns the repository
  • current_version - The current version string (e.g., “1.0.0”)

§Returns

Returns a Result<UpdateInfo, anyhow::Error> containing update information if successful, or an error if the check fails.

§Errors

This function will return an error if:

  • The network request fails
  • The GitHub API returns an error
  • The version strings cannot be parsed
  • The response format is unexpected
  • The repository does not exist or has no releases

§Examples

use update_available::check_github;

match check_github("my-repo", "username", "1.0.0") {
    Ok(info) => println!("{}", info),
    Err(e) => eprintln!("Error checking for updates: {}", e),
}