public static AppVeyorProjectBuild AppVeyorProjectLastSuccessfulBuild(this ICakeContext context, AppVeyorSettings settings, string accountName, string projectSlug, string branch = null, int?beforeBuildId = null) { var appVeyor = AppVeyorClient.Create(settings.ApiToken); AppVeyorProjectBuild lastSuccess = null; int?startBuildId = beforeBuildId; while (lastSuccess == null) { var history = appVeyor.GetProjectHistory(accountName, projectSlug, 2, startBuildId: startBuildId).Result; if (history == null || history.Builds == null || history.Builds.Count <= 0) { break; } foreach (var build in history.Builds) { if (build.Status.Equals("success", StringComparison.OrdinalIgnoreCase)) { lastSuccess = new AppVeyorProjectBuild { Project = history.Project, Build = build, }; break; } } startBuildId = history.Builds.Last().BuildId; } return(lastSuccess); }
public static AppVeyorProjectBuild AppVeyorProjectLastSuccessfulBuild (this ICakeContext context, AppVeyorSettings settings, string accountName, string projectSlug, string branch = null, int? beforeBuildId = null) { var appVeyor = AppVeyorClient.Create (settings.ApiToken); AppVeyorProjectBuild lastSuccess = null; int? startBuildId = beforeBuildId; while (lastSuccess == null) { var history = appVeyor.GetProjectHistory (accountName, projectSlug, 2, startBuildId: startBuildId).Result; if (history == null || history.Builds == null || history.Builds.Count <= 0) break; foreach (var build in history.Builds) { if (build.Status.Equals ("success", StringComparison.InvariantCultureIgnoreCase)) { lastSuccess = new AppVeyorProjectBuild { Project = history.Project, Build = build, }; break; } } startBuildId = history.Builds.Last ().BuildId; } return lastSuccess; }