loading...
Cover image for Build a GitHub Stargazer - Get Slack alerts when somebody stars your project in 4 lines of code

Build a GitHub Stargazer - Get Slack alerts when somebody stars your project in 4 lines of code

jcabot profile image Jordi Cabot Updated on ・2 min read

All the self-help gurus keep telling you that you should control your instincts and avoid checking your GitHub projects to see if somebody starred any of them in the last 5 minutes. I have the same problem (yes, first world problems). And as usual, changing the system/environment is easier than changing your own behaviour.

That's why I've changed the way to check for stars counting from a pull to a push approach by using the Xatkit bot development platform.

Now, instead of me checking GitHub for new notifications, I have a bot that alerts me automatically every time somebody stars one of my projects, as you can see in the featured image above. By using our (now extended)

GitHub logo xatkit-bot-platform / xatkit-github-platform

Receive events and perform actions on Github from your Xatkit execution model

Xatkit Github Platform

License Badge Build Status Wiki Badge

Receive events and performs action on Github from your Xatkit execution model. This platform is bundled with the Xatkit release.

Providers

The Github platform define the following providers:

Provider Type Context Parameters Description
GithubWebhookEventProvider Event - Receive webhook events from the Github API and translate them into Xatkit-compatible events.

GithubWebhookEventProvider Events

Event Context Parameters Description
Issue_Opened issue See the platform file Event sent when a new issue is opened in the repository.
Issue_Edited issue See the platform file Event sent when an issue is edited.
Issue_Closed issue See the platform file Event sent when an issue is closed.
Issue_Reopened issue See the platform file Event sent when an issue is reopened.
Issue_Assigned issue See the platform file Event sent when an issue is assigned.
Issue_Unassigned issue See the platform file Event sent when an issue is unassigned.
Issue_Labeled issue See the platform file Event sent when
creating this bot is as easy as writing the following four lines of code:

Basically, we subscribe to the Star_Event and extract out of the JSON Payload sent by GitHub all the data we want to integrate into our message. The reception of the event, the parsing of the JSON data,... is all done by the GithubPlatform.GithubWebhookEventProvider class. We just take what we need from the processed information. As usual, in this example, we post the result on Slack but this is up to you, just make sure you configure the properties file.

Note that the bot can also be the bearer of bad news. If some lesser person decides to unstar your repo you'll get also the proper notification. In both cases, the alert is immediate since we process the GitHub events as they come.

GitHub alert when somebody unstars your repository

Our Xatkit-GitHub platform is bidirectional. Beyond subscribing to GitHub events we can also call GitHub ourselves to create new issues, add labels, users,... based on a chat conversation taking place on an external platform. We have another example for this: Talk with your repositories – A Slack chatbot for GitHub. See this and other examples in our dedicated xatkit examples repo.

I hope these examples show you how powerful this integration between Xatkit and GitHub can be. Surprise me with your own examples!.

And of course, if you liked it, don't forget to star our repo. You'll made my day if I start getting plenty of star alerts from you!

GitHub logo xatkit-bot-platform / xatkit-releases

Releases of Xatkit. Simplest way to build advanced chatbots and digital assistants

Xatkit Releases

Wiki Badge

This repository contains the releases of the Xatkit framework. You can download the latest release here, or pick the one you need from the release list.

What's in the box?

Each release contains two artifacts:

  • xatkit_X.Y.Z.zip: the Xatkit runtime bundled with a list of preset platforms. The Xatkit runtime runs your digital assistants, stores logs and monitoring information, and manages your assistant's life-cycle. The list of bundled platforms is available in the release description.
  • xatkit-update-site_X.Y.Z.zip: an Eclipse update site containing the Xatkit language editors. The editors allows to define intent libraries, platform specifications, and mix them in complex execution logic that can be executed by the Xatkit runtime.

Quick Start

1- Download the latest release and extract xatkit_3.0.0.zip.

2- Setup the environment variable

Windows

Execute xatkit/install-windows.bat with administrative rights

Ubuntu

Execute xatkit/install-linux.sh

Xatkit Tip: don't waste your time!

This operation is only required…

Posted on Sep 11 '19 by:

jcabot profile

Jordi Cabot

@jcabot

ICREA Research Professor at Internet Interdisciplinary Institute (UOC) where I’m leading the SOM Research Lab focusing on the intersection between software engineering, AI and open source.

Discussion

markdown guide