public string GetCommitHash() { Repository latest = _repository.Find(r => true).OrderByDescending(r => r.DateTime).FirstOrDefault() ?? new Repository(); return(latest.CommitHash); }
public async Task <string> GetGithubHash() { Reference reference = await _github.Git.Reference.Get(REPOSITORY_OWNER, REPOSITORY_NAME, "heads/master"); string hash = reference.Object.Sha; Repository latest = _repository.Find(r => true).OrderByDescending(r => r.DateTime).FirstOrDefault() ?? new Repository(); latest.CommitHash = hash; latest.DateTime = DateTime.Now; _repository.Upsert(latest); return(hash); }