public GitHubController(GitHubService gitHubService) => _gitHubService = gitHubService;
public void UpdateGitHubContributorsJsonFile() { var service = new GitHubService(); service.UpdateOverallContributors(); }
public HttpClientController(IHttpClientFactory httpClientFactory, GitHubService gitHubService, IGithubClient githubClient) { _httpClientFactory = httpClientFactory; _gitHubService = gitHubService; _githubClient = githubClient; }
public async void CheckLatestVersion() { GitHubService service = new GitHubService(); Version currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; GitHubRelease latestRelease = await service.LatestRelease(); if (latestRelease.version > currentVersion) { this.Hide(); VersionWindow versionWindow = new VersionWindow(latestRelease); versionWindow.StartPosition = FormStartPosition.CenterScreen; versionWindow.MinimizeBox = false; versionWindow.MaximizeBox = false; versionWindow.Show(); versionWindow.Activate(); versionWindow.FormClosed += (sender, e) => { this.Show(); }; } }
internal GitHubUsersEndpoint(GitHubService service) { Service = service; }
public void AddCommentToStateHQDiscussionIssues(PerformContext context) { var gitHubService = new GitHubService(); RecurringJob.AddOrUpdate(() => gitHubService.AddCommentToStateHQDiscussionIssues(context), Cron.MinuteInterval(10)); }
internal GitHubOrganizationsEndpoint(GitHubService service) { Service = service; }
public MiscModule(GitHubService gitHub, HttpClient httpClient, DiscordSocketClient discord) { _git = gitHub; _http = httpClient; _discord = discord; }
public TypedClientModel(GitHubService gitHubService) =>
public ProjectCreateActivity(GitHubService github) { this.github = github ?? throw new ArgumentNullException(nameof(github)); }
public AppWebhookTrigger(GitHubService github) { this.github = github ?? throw new ArgumentNullException(nameof(github)); }
public ProjectsCategoriesReport GetGitHubCategoriesProjects() { var gitHubService = new GitHubService(); var labelReport = gitHubService.GetLabelReport(); var pcReport = new ProjectsCategoriesReport { Projects = new List <ProjectLabel>(), Categories = new List <CategoryLabel>() }; foreach (var report in labelReport.Where(x => x.Projects.Any())) { foreach (var project in report.Projects.OrderBy(x => x.Name)) { var projectName = project.Name.Split('/').Skip(1).First().Replace("-", " ").ToLower(); projectName = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(projectName); var foundProject = pcReport.Projects.FirstOrDefault(x => x.ProjectName == projectName); if (foundProject != null && foundProject.Repositories.Any(x => x == report.Repository) == false) { foundProject.Repositories.Add(report.Repository); } else { var proj = new ProjectLabel { Repositories = new List <string> { report.Repository }, ProjectName = projectName }; pcReport.Projects.Add(proj); } } } foreach (var report in labelReport.Where(x => x.Categories.Any())) { foreach (var category in report.Categories.OrderBy(x => x.Name)) { var categoryName = category.Name.Split('/').Skip(1).First().Replace("-", " ").ToLower(); categoryName = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(categoryName); var foundCategory = pcReport.Categories.FirstOrDefault(x => x.CategoryName == categoryName); if (foundCategory != null && foundCategory.Repositories.Any(x => x == report.Repository) == false) { foundCategory.Repositories.Add(report.Repository); } else { var cat = new CategoryLabel { Repositories = new List <string> { report.Repository }, CategoryName = categoryName }; pcReport.Categories.Add(cat); } } } return(pcReport); }
public ValuesController(IHttpClientFactory clientFactory, GitHubService gitHubService) { _clientFactory = clientFactory; _gitHubService = gitHubService; }
internal GitHubRepositoriesEndpoint(GitHubService service) { Service = service; }
public void GetAllGitHubLabels(PerformContext context) { var gitHubService = new GitHubService(); RecurringJob.AddOrUpdate(() => gitHubService.DownloadAllLabels(context), Cron.MonthInterval(12)); }
public GitHubHealthCheck(GitHubService gitHubService) { _gitHubService = gitHubService; }
public void AddCommentToAwaitingFeedbackIssues(PerformContext context) { var gitHubService = new GitHubService(); RecurringJob.AddOrUpdate(() => gitHubService.AddCommentToAwaitingFeedbackIssues(context), Cron.MinuteInterval(10)); }
public List <Issue> GetAllCommunityIssues(bool pulls) { var issues = new List <Issue>(); var pullRequestService = new GitHubService(); var hqMembers = pullRequestService.GetHqMembers(); var teamMembers = pullRequestService.GetTeamMembers(); foreach (var directory in Directory.EnumerateDirectories(IssuesBaseDirectory)) { var directoryName = directory.Split('\\').Last(); var repositoryName = directoryName.Substring(directoryName.LastIndexOf("__", StringComparison.Ordinal) + 2); var issuesDirectory = directory + "\\issues\\"; if (pulls) { issuesDirectory = issuesDirectory + "\\pulls\\"; } if (Directory.Exists(issuesDirectory) == false) { continue; } var issueFiles = Directory.EnumerateFiles(issuesDirectory, "*.combined.json"); var reviewers = new List <string>(); reviewers.AddRange(hqMembers); var team = teamMembers.FirstOrDefault(x => x.TeamName == repositoryName); if (team != null) { reviewers.AddRange(team.Members); } foreach (var file in issueFiles) { var fileContent = File.ReadAllText(file); var item = JsonConvert.DeserializeObject <Issue>(fileContent); // Exclude issues created by HQ if (hqMembers.Contains(item.User.Login.ToLowerInvariant())) { continue; } item.RepositoryName = repositoryName; foreach (var comment in item.Comments) { var commenter = comment.User.Login.ToLowerInvariant(); if (item.FirstPrTeamOrHqComment == null && reviewers.Contains(commenter)) { item.FirstPrTeamOrHqComment = comment.CreateDateTime.ToLocalTime(); } } issues.Add(item); } } return(issues); }
public void NotifyUnmergeablePullRequests(PerformContext context) { var gitHubService = new GitHubService(); RecurringJob.AddOrUpdate(() => gitHubService.NotifyUnmergeablePullRequests(context), Cron.MonthInterval(12)); }
public List <GitHubCategorizedIssues> GetAllOpenIssues(bool pulls) { var allIssues = GetAllCommunityIssues(pulls); var openIssues = new List <GitHubCategorizedIssues> { new GitHubCategorizedIssues { SortOrder = 1, CategoryDescription = "No reply", CategoryKey = CategoryKey.NoReply, Issues = new List <Issue>() }, new GitHubCategorizedIssues { SortOrder = 10, CategoryDescription = "HQ discussion", CategoryKey = CategoryKey.HqDiscussion, Issues = new List <Issue>() }, new GitHubCategorizedIssues { SortOrder = 20, CategoryDescription = "HQ reply", CategoryKey = CategoryKey.HqReply, Issues = new List <Issue>() }, new GitHubCategorizedIssues { SortOrder = 30, CategoryDescription = "Up For Grabs", CategoryKey = CategoryKey.UpForGrabs, Issues = new List <Issue>() }, new GitHubCategorizedIssues { SortOrder = 40, CategoryDescription = "Pull Request Pending", CategoryKey = CategoryKey.PullRequestPending, Issues = new List <Issue>() }, new GitHubCategorizedIssues { SortOrder = 10000, CategoryDescription = "Other", CategoryKey = CategoryKey.Other, Issues = new List <Issue>() } }; var pullRequestService = new GitHubService(); var hqMembers = pullRequestService.GetHqMembers(); var teamMembers = pullRequestService.GetTeamMembers(); var teamUmbraco = hqMembers; if (teamMembers != null) { foreach (var teamMember in teamMembers) { foreach (var member in teamMember.Members) { teamUmbraco.Add(member); } } } foreach (var item in allIssues.Where(x => x.Labels.Any(l => l.Name == "status/idea") == false)) { if (item.State == "closed") { continue; } if (item.Comments.Any()) { // Only Team Umbraco members can add labels, it's not exactly what we want to do but // labeling counts as a "reply" even if there's no comments by Team Umbraco on the issue if (item.Labels.Length == 0) { // If nobody on Team Umbraco labeled the issue NOR left a comment, it needs a reply var teamUmbracoHasReplied = item.Comments.Any(c => teamUmbraco.InvariantContains(c.User.Login)); if (teamUmbracoHasReplied == false) { var noFirstReplyCategory = openIssues.First(x => x.CategoryKey == CategoryKey.NoReply); noFirstReplyCategory.Issues.Add(item); continue; } } // The last comment was not from Team Umbraco, we might need to help move this issue along var latestComment = item.Comments.OrderByDescending(x => x.CreateDateTime).FirstOrDefault(); if (latestComment != null && teamUmbraco.InvariantContains(latestComment.User.Login) == false) { item.NeedsTeamUmbracoReply = true; } } else { item.NeedsTeamUmbracoReply = true; } if (item.Labels.Length == 0 && item.CommentCount == 0) { var noFirstReplyCategory = openIssues.First(x => x.CategoryKey == CategoryKey.NoReply); noFirstReplyCategory.Issues.Add(item); continue; } if (item.Labels.Length != 0) { var matchedLabel = false; foreach (var label in item.Labels) { var labels = new[] { "state/hq-discussion-ux", "state/hq-discussion-cms", "state/hq-discussion-cloud" }; if (labels.Contains(label.Name) == false) { continue; } matchedLabel = true; AddCategoryCreatedDate(item, label, labels); var hqDiscussionCategory = openIssues.First(x => x.CategoryKey == CategoryKey.HqDiscussion); hqDiscussionCategory.Issues.Add(item); } // only go to the next item in the // foreach if we found a match here if (matchedLabel) { continue; } foreach (var label in item.Labels) { var labels = new[] { "state/hq-reply" }; if (labels.Contains(label.Name) == false) { continue; } matchedLabel = true; AddCategoryCreatedDate(item, label, labels); var hqReplyCategory = openIssues.First(x => x.CategoryKey == CategoryKey.HqReply); hqReplyCategory.Issues.Add(item); } // only go to the next item in the // foreach if we found a match here if (matchedLabel) { continue; } foreach (var label in item.Labels) { var labels = new[] { "community/pr" }; if (labels.Contains(label.Name) == false) { continue; } matchedLabel = true; AddCategoryCreatedDate(item, label, labels); var prPendingCategory = openIssues.First(x => x.CategoryKey == CategoryKey.PullRequestPending); prPendingCategory.Issues.Add(item); } // only go to the next item in the // foreach if we found a match here if (matchedLabel) { continue; } foreach (var label in item.Labels) { var labels = new[] { "up-for-grabs", "community/up-for-grabs", "help wanted" }; if (labels.Contains(label.Name) == false) { continue; } matchedLabel = true; var upForGrabsCategory = openIssues.First(x => x.CategoryKey == CategoryKey.UpForGrabs); // We're matching on several labels, so only add the item once in case there's multiple matches if (upForGrabsCategory.Issues.Contains(item) == false) { AddCategoryCreatedDate(item, label, labels); upForGrabsCategory.Issues.Add(item); } } // only go to the next item in the // foreach if we found a match here if (matchedLabel) { continue; } } var otherCategory = openIssues.First(x => x.CategoryKey == CategoryKey.Other); otherCategory.Issues.Add(item); } return(openIssues.OrderBy(x => x.SortOrder).ToList()); }
public void SetUp() { handler = new FakeMessageHandler(); service = new GitHubService(handler); }
public GitHubController(GitHubService githubService) { _githubService = githubService; }
internal GitHubRepositoriesEndpoint(GitHubService service) { Service = service; }
public TypedClientModel(GitHubService gitHubService) { _gitHubService = gitHubService; }