Development teams frequently handle many pull requests concurrently. A release engineer could need to know if a pull request has been closed or merged, a team lead might be examining build data, or a developer might be awaiting a code review. It becomes challenging to monitor the team's progress when this data is dispersed over several GitHub sites. This data may be consolidated into a single location using a developer dashboard. The dashboard may receive events from GitHub and refresh its display whenever something changes, eliminating the need to manually review pull requests on a regular basis.
This kind of application may be developed with GitHub Event Streams. It enables an integration to get notifications via Server-Sent Events (SSE) and subscribe to changes on a specific pull request. The application may then refresh its dashboard by retrieving the most recent pull request data.
A queue is being used to grant access to the public preview of GitHub Event Streams. Pull request events on GitHub.com are presently supported. The functionality does not take the place of a general-purpose event feed or repository-wide webhooks.
This post will discuss how to process incoming events in a.NET application, create a developer dashboard using GitHub Event Streams, and present helpful data for a development team.
A useful pull request dashboard can include:
| Dashboard field | Information displayed |
| Repository |
Repository name |
| Pull request |
Number and title |
| Author |
Developer who created the pull request |
| Review status |
Approved, changes requested, or pending |
| Build status |
Success, failure, or running |
| Merge status |
Open, merged, or closed |
| Last activity |
Most recent detected update |
For example, when a check-suite event reports a failure, the dashboard can update the build status and highlight the affected pull request.
When a review event arrives, the backend can fetch the review details and update the review status.
When the pull request is merged, the dashboard can move it from the active review list into the completed section.
SignalR is a suitable option for sending these updates from an ASP.NET Core backend to browser clients. The dashboard does not need to open separate GitHub event streams for every user viewing the page. Instead, the backend maintains the subscriptions and distributes processed updates to authorized users.
Handling Duplicates, Disconnections, and Subscription Expiration
A production dashboard must account for problems that are normal in long-lived event connections.
First, events may arrive more than once. Store processed event identifiers or another suitable deduplication key in the database. For review and check-suite events, the resource URL can also help identify the underlying resource.
Second, events can arrive out of order. Do not update a pull request's final state simply by applying events in the order received. Fetch its current state from GitHub when an event requires additional information.
Third, events are not replayed. If the application disconnects, changes that occur during that period may be missed. After establishing a subscription and opening the stream, fetch the current pull request state to reconcile the dashboard.
Fourth, subscriptions expire after 24 hours. The subscription manager should track expiration and create replacement subscriptions when monitoring needs to continue.
Finally, handle the github.stream.end event. When its outcome indicates reconnect, reopen the stream with backoff and refresh an installation token if necessary. When the outcome indicates subscription_ended, create a new subscription only if the application still needs to monitor that pull request.
Best Practices for Production Applications
Keep GitHub integration code separate from dashboard business logic. The event listener should collect events, while a dedicated processor validates them, retrieves current resource state, and updates application data.
Store subscription metadata and processed event identifiers in a database. This allows the application to recover after a service restart without losing track of monitored pull requests.
Use cancellation tokens and connection timeouts appropriately. A long-lived SSE connection should not be treated like an ordinary short HTTP request.
Monitor subscription counts because GitHub limits active subscriptions to 100 per user, app, or installation token. Subscribe only to the pull requests that the dashboard actually needs to monitor.
Also, remember that Event Streams is currently in public preview. Its API, event types, and limits may change. Keep the integration isolated behind a service interface so that changes in the GitHub API do not require rewriting the dashboard.
Summary
GitHub Event Streams provides a useful way to build responsive developer dashboards without continuously polling pull request endpoints. By creating subscriptions and receiving updates through SSE, an ASP.NET Core application can monitor review activity, check-suite results, pull request state changes, and new commits.
A reliable implementation needs more than an event listener. It should include subscription management, duplicate detection, resource-state reconciliation, reconnection handling, and subscription renewal. By combining GitHub Event Streams with a backend processing service, a database, and SignalR, development teams can build a centralized dashboard that keeps important pull request information available in one place.
HostForLIFE.eu ASP.NET Core 11.0 Hosting
European best, cheap and reliable ASP.NET hosting with instant activation. HostForLIFE.eu is #1 Recommended Windows and ASP.NET hosting in European Continent. With 99.99% Uptime Guaranteed of Relibility, Stability and Performace. HostForLIFE.eu security team is constantly monitoring the entire network for unusual behaviour. We deliver hosting solution including Shared hosting, Cloud hosting, Reseller hosting, Dedicated Servers, and IT as Service for companies of all size.
