This tutorial uses WayScript, a rapid development platform for devs like you. The beauty of WayScript is that all scripts can be shared privately or publicly. A completed script of this tutorial can be found here.
Introduction
Whether your team size is large or small, monitoring commits to your Github repositories can be a challenge. With numerous branches, it becomes easier to miss those important commits that you need to see. With WayScript, we can easily build a system that with notify us, on our chosen platform, about new pushes to certain branches within our repositories. In this example, let's build an automated system that will send us a slack notification whenever there's a new commit to our master branch.
Prerequisites
No prerequisites but some content you might find helpful:
Working with Slack
Working with GitHub Triggers
Activating a Script with GitHub Events
WayScript provides a way for us to run our scripts whenever a specified event happens on GitHub. We can monitor several things, such as push events, issues, pull requests, and more. To activate this trigger, we first need to pull it into our workflow.
Once we have this trigger in, we have a menu to the left that allows us to visually select the interacts we want to monitor on GitHub to activate our workflow.
To monitor for pushes to master, let's configure our trigger settings to something like this:
These settings will cause our actions below to activate whenever a new push to master occurs. Finally, we're able to select outputs from this trigger to use in other steps if we want. Let's use an output of the commit messages and pass this to slack for the notification.
Writing a Slack Notification
To write to Slack, we'll use a slack module. We can drag this in from the module selection, and place it below our Github trigger.
The slack module allows us to easily write to the slack channel of our choice, with dynamic messages. We can use the commit text from the pushes to master to populate our messages.
Configuring the Slack Notification
Opening up the settings, we'll fill them out with something like this:
Next we can drag the variable text from our github message into the message text box.
Now, any time a push to our designated branch occurs, we'll receive a slack notification that has the message of the commits to our slack channel.
Questions, Concerns?
If there's any questions feel free to message us on discord. We're happy to help! If you want to see this full script template, you can find it here.
CHECK OUT THE VIDEO: Here's a link to the video for this tutorial.
Top comments (0)