VictorGrycuk / streamdeck-repository-watcher

A plug in for StreamDeck that will monitor the count of issues or pull request of a given GitHub repository.
GNU General Public License v3.0
11 stars 2 forks source link
elgato github issues pull-requests streamdeck streamdeck-plugin

Repository Watcher for StreamDeck

Please refer to the documentation for the most recent information

Description

This is a plug in for StreamDeck that will monitor the count of issues or pull request of a given GitHub repository.

The plug in will check the repository and show the count of either issues or pull requests that meet the filter criteria.

See the features below for more details.

This was done using BarRaider's Stream Deck Tools.

Features

Configuration

Shared Configuration

Issue Watcher

All of these are optional filters that can be stacked.

Pull Request Watcher

All of these are optional filters that can be stacked.

The GitHub API is more limited regarding on the filters that can be applied to the pull requests request, so if you wish to fine tune the counting of pull requests, you will have to use the custom filters.

Considerations

What the GitHub API returns

The API returns anything that has been update within the specified time frame.

For example, if the plug in is configured to return the amount of issues with the state open with the initial offset time frame of 2 days, it will return all the open issues that has been updated within the last two days. It will not return the issues that were open in the last two day.

An issue/pull requests is considered updated if it has been:

If you want to have a better control on what is being returned and counted, use custom filtering.

Every pull request an issue, but not every issue is a pull request

A caveat of the GitHub API, the GetIssues method not only return issues but may also return pull requests as well.

According to the GitHub documentation:

GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key. Be aware that the id of a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "List pull requests" endpoint.

However, with this in mind, the implementation of the API for this plug in returns all the issues without an associated pull request.

Custom Filters

Description

Since the GitHub API is quite limited on regards the filters that can be applied to the requests, specially for the pull request, 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.

Examples

If you wanted to count only the pull requests or issues that were open within the last 2 days, you can use:

Octokit,System,System.Linq,System.Collections.Generic;
x => 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:

Octokit,System,System.Linq,System.Collections.Generic;
x => 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:

Octokit,System,System.Linq,System.Collections.Generic;
x => x.Merged == true;
x => x.UpdatedAt > DateTime.Now.Subtract(new TimeSpan(1, 0, 0));

Considerations

My others Stream Deck plugins


The icons are modified version of Repository iOS Glyph and Repository Fluent at Icon8.