Because the GitHub API is quite limited on regards the filters that can be applied to the requests, specially for the pull requests, I added the possibility to apply custom filters using Roslyn scripting to the result of the call.
These filters are basically lambdas expressions that are applied to the result of the GitHub request sequentially. This, of course, requires a basic knowledge of the models used by the Octokit.net library.
Since Roslyn executes the scripts inside a sandbox, it requires to also specify the imports directives. The most commons are Octokit
, System
, and System.Linq
, and others depending your need.
The first line of the Custom Filter text area is reserved for the import directives, they have to be comma-separated
The lambdas can be declared starting the second line
All the lines have to end with ;
These are some examples to give you an idea on how to use the custom filters.
If you wanted to count only the pull requests or issues that were open within the last 2 days, you can use:
1linkOctokit,System,System.Linq,System.Collections.Generic;
2linkx => x.CreatedAt > DateTime.Now.Subtract(new TimeSpan(2, 0, 0, 0));
If you wanted to count only the pull requests or issues that have the label Team: SuperTeam
, you can use:
1linkOctokit,System,System.Linq,System.Collections.Generic;
2linkx => x.Labels.Any(x => new string[] { \"Team: SuperTeam\" }.Contains(x.Name));
If you wanted to count only the pull requests that are merged and updated within the last hour, you can use:
1linkOctokit,System,System.Linq,System.Collections.Generic;
2linkx => x.Merged == true;
3linkx => x.UpdatedAt > DateTime.Now.Subtract(new TimeSpan(1, 0, 0));