Search code examples
c#apigithubreleaseoctokit.net

How can I check github releases in c#?


Something like this.

void UpdateCheck()
{
    if (GithubApi.GetCurrentRelease().Version > CurrentVersion)
}

How can I do this?

I found some API, https://github.com/octokit/octokit.net

but I can't find this function.


Solution

  • Using Octokit.net you should be able to get started using this example from the documentation:

    Get All

    To retrieve all releases for a repository:

    var releases = client.Release.GetAll("octokit", "octokit.net");
    var latest = releases[0];
    Console.WriteLine(
        "The latest release is tagged at {0} and is named {1}", 
        latest.TagName, 
        latest.Name); 
    

    Alternatively, you could use the API directly:

    List releases for a repository

    Information about published releases are available to everyone. Only users with push access will receive listings for draft releases.

    GET /repos/:owner/:repo/releases