Follow @VictorGrycuk

Created With

linkCustom Filters

linkDescription

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.

linkConsiderations

linkExamples

These are some examples to give you an idea on how to use the custom filters.

linkOpenened within last 2 days

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));

linkOnly with a specific label

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));

linkCount merged within the last hour

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));

Custom FiltersDescriptionConsiderationsExamplesOpenened within last 2 daysOnly with a specific labelCount merged within the last hour

Home Getting Started

Watcherschevron_right

Custom Filters Considerations & Known Issues