private async Task SetBuildInfo(PlayServices.Build buildInfo) { var client = CreateDynamoDbClient(); var context = new DynamoDBContext(client); var cfg = new DynamoDBOperationConfig() { OverrideTableName = Environment.GetEnvironmentVariable(ConfigKeys.g_env_ps_builds_dynamodb_table_name) }; var bi = new BuildInfo(); bi.Commit = g_commitId; bi.Build = buildInfo; await context.SaveAsync(bi, cfg); }
private async Task <PlayServices.Build> GetTopCommitInfo() { var ghToken = Environment.GetEnvironmentVariable(ConfigKeys.g_env_ps_gh_apitoken); var client = new GitHubClient(new ProductHeaderValue("PlayServices")); client.Credentials = new Credentials(ghToken); var masterCommit = await client.Repository.Commit.Get(g_userName, g_repositoryName, "heads/master"); var masterStatus = await client.Repository.Status.GetCombined(g_userName, g_repositoryName, "heads/master"); bool hasBuild = masterStatus.State == CommitState.Success; var build = new PlayServices.Build(); build.CommitMessage = masterCommit.Commit.Message; build.CommitDate = masterCommit.Commit.Committer.Date.UtcDateTime; build.CommitHash = masterCommit.Sha.Substring(0, 8); build.HasBuild = masterStatus.State == CommitState.Success; build.Timestamp = DateTime.UtcNow; return(build); }