forked from octokit/octokit.net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05-interact-with-git-database.linq
34 lines (26 loc) · 1.07 KB
/
05-interact-with-git-database.linq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<Query Kind="Program">
<NuGetReference>Octokit</NuGetReference>
<NuGetReference>Octokit.Reactive</NuGetReference>
<Namespace>Octokit</Namespace>
<Namespace>System.Threading.Tasks</Namespace>
</Query>
async Task Main(string[] args)
{
var owner = string.Empty;
var reponame = string.Empty;
GitHubClient client = new GitHubClient(new Octokit.ProductHeaderValue("Octokit.samples"));
owner = "octokit";
reponame = "octokit.net";
var releases = await client.Repository.Release.GetAll(owner, reponame);
// we have to build up this tag because release tags
// are just lightweight tags. you can read more about
// the differences between lightweight tags and annotated tags
// here: http://git-scm.com/book/en/Git-Basics-Tagging#Creating-Tags
// we can fetch the tag for this release
var reference = "tags/" + releases[0].TagName;
var tag = await client.Git.Reference.Get(owner, reponame, reference);
tag.Dump();
// and we can fetch the commit associated with this release
var commit = await client.Git.Commit.Get(owner, reponame, tag.Object.Sha);
commit.Dump();
}