Github Subscribe Slack



Big projects easily have dozens, if not hundreds, of open source dependencies. Keeping up with possibly breaking changes and security risks is a feat in its own. In this article I will outline to you how we integrate GitHub with Slack to receive release information and announcements using concise, serverless Azure Logic and Function Apps.

Github Subscribe Slack

Preparation

To recreate this integration you need an Outlook.com email address, a Slack account with administration rights and a Microsoft Azure subscription, all of which are free*. Finally, this integration will make use of a service called Sibbell and this is how it goes.

  • GitHub has the option to send notifications to your mail address on issues and pull requests for repositories you watch. There are plenty of repositories used solely for announcements (e.g., aspnet/Announcements).
  • Sibbell integrates with your GitHub account to send you mails about new release information on any of your watched or starred repositories.
  • Azure apps act as a link between your inbox and your Slack team.

시간을 절약하고 인적 오류를 줄이는 데 도움이됩니다.그러나 자동화는 어려울 수 있으며 때로는 비용이 많이들 수 있습니다. Github Actions는 어떻게 코드를 강화하고 버그 대신 기능 작업에 더 많은 시간을 할애 할 수 있습니까?Github 작업이란 무엇입니까?CI / CD 란 무엇입니까?무엇을 만들까요?파트 0. Feb 27, 2018 Simply subscribe to the RSS feed of the github page you wish to be notified of with the Slack RSS feed app.

Subscribe to repositories

Sign up for GitHub with your newly created Outlook address and subscribe to repositories that are relevant to your team. Now, open up your account settings and activate notifications:

Integrate Sibbell with GitHub

Next, visit Sibbell.com and grant the app access to your profile information. You can revisit your subscriptions under “Projects“. It is possible to revoke access at any given time:

Set up Azure

Finally, on your Azure dashboard click “New” on the left sidebar and search for “Logic App“. Close the Logic App blade for now and repeat the last step with a new “Function App“. Make absolutely sure to pick a Consumpion Plan. There are no upfront setup costs involved. Instead, per-usage based billing applies ($0.0008 / execution as of the date of writing). Trial accounts start with a free $200 credit.

L is for Logic

Now what exactly are Logic and Function Apps? Maybe you have prior experience with developing and deploying classic Web Apps on Azure but have not yet worked with these types of services.

Azure Logic Apps provide a graphical interface to build cloud integrations and automate workflows with predefined building blocks. In theory, it is feasible for a non-technical person to define workflows. Similar services for end users exist, most notably IFTTT, Zapier and Microsoft Flow.


Azure Function Apps are Microsoft’s answer to serverless computing. Beyond IaaS and PaaS, serverless solutions eliminate most pain points with quick provisioning of applications performing simple tasks, especially ceremony. Better yet, Function Apps serve as extension points for Logic Apps. From a developer’s point of view, Function Apps are a set of HTTP request handlers that each listen to a single URL.

To put all this into practice, open up the just created Logic App on your dashboard, click on “Logic App Designer” and choose the blank template. As for the trigger kicking off the workflow search for “Outlook” and choose “Outlook.com – When a new email arrives“. Enter your credentials and set the frequency to somewhere around 60 minutes. As the next step (“New step” button) pick a condition, switch to advanced mode and enter the following conditional statement:

@or(equals(triggerBody()?['From'], 'releases@sibbell.com'), equals(triggerBody()?['From'], 'notifications@github.com'))

For further information about the syntax consult the reference page for Logic Apps. Inside the “IF YES” branch (sender is releases@sibbell.com or notifications@github.com) add the “SlackPost Message” action and proceed by signing in and granting access to Azure Logic Apps.

While the defined workflow already posts to a selected Slack channel, the HTML content contained by the mail body needs to be turned into Markdown in order to be remotely decipherable in Slack. Unfortunately, no predefined action is capable of such a task. This is where the previously deployed Function App comes to rescue. So, save your work and return to the dashboard to bring up the Function App.

Click the ✚ next to “Functions” to create a new function. For my reference implementation I chose “Webhook + API” with JavaScript (Node.js) as my language of choice. 📥 Download the script and paste the contents of ParseGitHubMails.js into the editor. The script parses the two kind of mails expected from the Logic App, converts the contained HTML to Markdown and beautifies the output, eventually adding the property Markdown to the mail object. Lastly, follow the 4 steps listed on this site to restore npm packages and save the function.

Back in the Logic App Designer insert the missing step above “SlackPost Message” by picking “Azure Functions“, selecting your previously created function and passing “Body” from the “Add dynamic content” window. You can now use the property Markdown inside your Slack message. Your final result should look like this:

Mails passed through the pipeline now arrive in your Slack channel in this shape:

Github Subscribe Slack

This article, I hope, has given you some brief insights on how cloud workflows can be incorporated into your processes and ideas for applications in your enterprise.

* Azure has a 30-day trial phase. Afterwards, the integration costs about 50¢ / mo. Free Slack plan (limitations apply).

GitHub, which was recently bought by Microsoft is where developers around the world showcase their skills. Number of stars in a project determines its popularity & usefulness. GitHub doesn't seem to have any feature to notify you when your repository is starred or forked. You can only get to know this detail from your dashboard.

There's a trick you can implement to get notified about the following GitHub events on Slack.

  • Someone stars your project.
  • Someone forks your project.
  • Someone you follow stars a repository.
  • Someone you follow forks a repository.
  • Someone you follow creates a repository.
  • Someone you follow starts following someone.
  • The master branch of the repository you watch gets new commits.

How it works

To fetch events from GitHub, you're going to get your account feed URL from GitHub dashboard. Scroll to the bottom of your dashboard. Right-click the link Subscribe to your news feed and select Copy link address. We'll use that feed URL to push notification on your Slack.

How to start notifications

First of all, add RSS app to your Slack workspace. Once it's successfully installed, sign-in to your Slack workspace. You can make the notification come on any channel or direct message. Open the chat area and paste the below command. Replace marked text with your feed URL.

You may also like - How to know the size & creation date of a GitHub repo.

To get notified about pull requests, issues, comments, releases, deployments you can use GitHub - Slack integration.

How to stop the notifications

Open the chat area and send /feed list. You will get the list of feeds subscribed with ids. Now, copy the id for the GitHub feed. Then, send the below message after replacing the marked id with yours.

Github slack subscribe to repo

Limitations

Github Slack Subscribe

  • You can't configure or control what you receive.
  • Notification just serves the purpose and doesn't look fancy.
  • Notifications are usually delayed by 10 - 20mins.




Comments are closed.