コード例 #1
0
        public string GetCommitHash()
        {
            Repository latest = _repository.Find(r => true).OrderByDescending(r => r.DateTime).FirstOrDefault() ??
                                new Repository();

            return(latest.CommitHash);
        }
コード例 #2
0
        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);
        }