/// Gets the issues of a GitHub repository on the given page /// </summary> /// <param name="owner">The owner of the repository</param> /// <param name="repositoryName">The name of the repository</param> /// <returns>An array of issues in the repository</returns> public static async Task <Issue[]> GetIssuesFromRepository(string owner, string repositoryName) { Response resp = await Rest.GetAsync( "https://api.github.com/" + "repos/" + owner + "/" + repositoryName + "/issues", null, -1, null, true); ConnectionManager.Instance.CheckStatusCode(resp.ResponseCode); if (!resp.Successful) { Debug.LogError(resp.ResponseCode + ": " + resp.ResponseBody); return(null); } else { String json = "{ \"data\": " + resp.ResponseBody + " }"; Debug.Log(json); Issue[] issues = JsonArrayUtility.FromJson <Issue>(json); if (issues == null || issues.Length == 0) { Debug.Log("Array empty!"); } foreach (Issue issue in issues) { IssueCache.AddIssue(issue); } return(issues); } }
public async Task <RequestCollection> FindPullRequests(string location, bool useCache, IEnumerable <CommitInfo> commits) { var allIssues = await IssueCache.GetIssues(this.Client, location, useCache); var requests = new RequestCollection(allIssues); foreach (var commit in commits) { string prMatch = TryExpression(SquashExpression, commit); if (prMatch == null) { prMatch = TryExpression(MergeExpression, commit); } if (prMatch != null && Int32.TryParse(prMatch, out int id)) { var matchPR = allIssues.FirstOrDefault(x => x.Number == id); if (matchPR != null) { var labels = matchPR.Labels; if (labels.Count == 0) { var backport = TryBodyExpression(BackportExpression, matchPR.Body); if (backport != null && Int32.TryParse(backport, out int backportID)) { var matchBackport = allIssues.FirstOrDefault(x => x.Number == backportID); if (matchBackport != null) { labels = matchBackport.Labels; } } } if (!labels.Any(x => x == "not-notes-worthy")) { requests.Add(new RequestInfo(matchPR.Number, string.Format("{0:MM/dd/yyyy}", matchPR.ClosedAt), commit.Title, commit.Description, matchPR.Title, matchPR.Body, commit.Hash, commit.Author, matchPR.Url, labels.Where(x => IsInterestingLabel(x)).ToList())); } } } } return(requests); }
public UserHalfYearReport(IssueCache cache, Action <string> log = null) : base(cache, log) { }
private void ProcessInputs(List <StatisticItem> stat, Dictionary <string, RebuildInfo> rebuild, string trunkPrefix, Dictionary <string, IssueCache> cache, InputIssue[] model, Action <InputIssue[]> setter) { List <InputIssue> vi = new List <InputIssue>(); var now = DateTime.UtcNow; foreach (var item in rebuild) { InputIssueDesc result = InputIssueDesc.None; string id = item.Key; if (item.Value.Issue != InputIssueDesc.None) { result = item.Value.Issue; } else if (item.Value.Video?.Image == null) { // runtime issue var st = stat.FirstOrDefault(s => s.Name.Trunk == id && s.Name.Name == "I" && s.Name.TrunkPrefix == trunkPrefix); if (st?.Data is StatisticDataOfInputOutput iostat) { if (!cache.ContainsKey(id)) { cache[id] = new IssueCache { Created = now } } ; if (iostat.Errors > 0) { if (iostat.ErrorType == InputErrorType.InUse) { result = InputIssueDesc.InUse; } else { result = InputIssueDesc.Failed; } cache[id].FailedTime = DateTime.UtcNow; cache[id].Failure = result; } else if (iostat.Frames == 0) { var cacheEntry = cache[id]; if (now - cacheEntry.FailedTime < TimeSpan.FromSeconds(10)) { result = cacheEntry.Failure; } else if (now - cacheEntry.Created > TimeSpan.FromSeconds(3)) { cacheEntry.NoFramesCount++; if (cacheEntry.NoFramesCount >= 2) // two consequtive seconds { result = InputIssueDesc.NoFrames; } } } else if (iostat.Frames > 250) { result = InputIssueDesc.TooManyFrames; } else { cache[id].NoFramesCount = 0; } } //else // result = InputIssueDesc.UnknownState; } if (result != InputIssueDesc.None) { vi.Add(new InputIssue { Id = id, Desc = result }); } } if (vi.Count == 0) { if (model != null) { setter(null); } } else { var sorted = vi.OrderBy(s => s.Id).ToArray(); if (model == null || !model.SequenceEqual(sorted)) { setter(sorted); } } } }
public MonthlyReport(IssueCache cache, Action <string> log = null) : base(cache, log) { }
public Report(IssueCache cache, Action <string> log) => (this.cache, this.log) = (cache, log);