Github Subscribe Slack
- Visit slack.github.com and click Add to Slack. Review the permissions the app needs to access, and click Continue to allow. Select the channels the app can access: all public channels, specific ones, or none. After you've installed the app, the GitHub app will send you a direct message to help you complete setup and teach you about the /github slash command.
- The Github integration for Slack is great for team productivity. Having the ability to give Slack channels full visibility into Github projects, for real-time notifications, is an amazing way to keep the development team on the same page.
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.
Slack for web development! Here's a great guide on how to use Slack for your web development team and projects! GitHub Apps to automate and improve your workflow. Chat on Slack Contribute on GitHub Follow on Twitter Ask on Stack Overflow.
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.
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 “Slack – Post 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 “Slack – Post 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:
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).
The GitHub and Slack app has a few new features to help you stay informed about your projects. The integration now includes added support for deployments, checks, and draft pull requests to further enhance your productivity in Slack.
Create deployments
Currently, the GitHub and Slack app allows you to take action on your repository using commands to open, close, and reopen issues or pull requests. Now you can use the Deployments API to list and create deployments in your repositories without leaving your Slack channel. In addition to the updates you already get in your Slack channels about what’s happening on GitHub, you can now list and create deployments, get the status of checks on pull requests, and get notified of new draft pull requests—all without leaving your Slack channel.
Use commands to:
- List deployments on a repository with
/github deploy [owner]/[repo] list
- Create a deployment with
/github deploy [owner]/[repo]
When using the command to create a deployment, a dialog prompts you to select which branch or tag will be deployed and to which environment. You also have the option to specify a task and a payload. These fields are explained in the API section for creating deployments.
To use these new slash commands, a GitHub organization owner or repository admin must accept updated permissions in the GitHub and Slack app. This request can be viewed in the Applications tab under settings, or in email notifications sent to relevant users.
View checks on pull requests
The GitHub and Slack app currently reports status updates on open pull requests, and now we’re expanding support to checks as well. Any pull requests opened in the last 30 minutes will push Slack message attachment updates from integrations using the Checks API. Try it out, and check out the GitHub Marketplace for Checks API compatible integrations.
Get notified of new draft pull requests
Github Subscribe Slack Download
Draft pull requests was released earlier this year, and now it’s supported using the GitHub and Slack app. When a repository you’re subscribed to contains a new draft pull request, you’ll be notified in Slack. The message appears with a gray bar to indicate its draft status.
When this pull request is ready to be reviewed, you’ll also be notified so you’re aware that the work is no longer in progress.
Open source, open platform
Github Slack Subscribe
Slideshow apps for mac. The best collaboration happens in the open. This integration is available as open source and built with the same public APIs used by apps in the GitHub and Slack ecosystems. Visit the GitHub repository to contribute code, submit feature requests or bug reports, and learn more about how the app works.