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.
No prerequisites but some content you might find helpful:
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.
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.
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.