GitHub is an invaluable tool for software developers. GitHub, and other source control providers, bring several features: a place to store code, a history of changes, and reasons as to who did what, when and why. GitHub as a platform is pretty open-ended, and there are many strategies for managing your repositories.

Git methodologies are a dime a dozen, but what many have in common is the pull request. GitHub, provides a UI to allow maintainers to review, request changes, and accept pull requests. This guide takes it a step further by showing you how to set up a workflow with Build on Standard Library that sends SMS alerts on new pull requests, guaranteeing that you never miss one! Let’s get started!

The finished product

What You’ll Need Beforehand

1x GitHub account — https://www.github.com/

1x Cell Phone

5x Minutes (or 300x Seconds)

Minute 1: Set up your Workflow

First, we’ll head over to https://build.stdlib.com (Build on Standard Library) to create our workflow. You’ll want to pick the following options:

Event:

GitHub → pull_request opened

Actions:

Utils → Send an SMS

Click “Create Workflow” to continue

Once you have selected those options, click “Create Workflow”. You’ll be prompted to log in or sign up if you haven’t registered for Standard Library yet.

Minute 2: Link your GitHub Account

The next step is to link your GitHub account. Standard Library provides the concept of Identities that manage third-party API credentials. Identities allow you to link your GitHub account once and use it with any workflows you build. After clicking “Create Workflow” in the last step, you should see a screen like this:

Linking your GitHub account

From here, you’ll want to click the Link Resource button to the right of GitHub…

Click “Link Resource”

And you’ll be prompted with this screen:

Click “Link New Resource”

Click “Link New Resource” to proceed. You’ll be prompted to log in to GitHub and install the Standard Library GitHub app.

Installing the GitHub app

You can install it either directly on your account, or onto an organization you have admin access to. You’ll also be asked to allow the app to have access to all repositories, or you can select individual repositories you’d like the app to use. This setting is configurable after installation from your GitHub installations management page.

Click “Next” to Continue

After you install the app, click “Next” to continue.

Minute 3: Prototype your Workflow

You should now see a screen that looks like this:

Prototype your Workflow

This page is where you can configure the actions picked at the start of building your workflow. We only picked one; Utils → Send an SMS. It takes up to three parameters. For our purposes, we’re only going to need to configure the first two.

First, the to parameter. This should be your phone number or the phone number of a coworker you’d like to bother. For the second parameter, body , we need to utilize some of the parameters passed in with the event: GitHub → pull_request opened. body is a string, so we can use ${} to interpolate the event parameters into the message. Feel free to copy and paste this sample:

New pull requested opened in ${event.repository.full_name}

It was opened by ${event.sender.login} and is titled "${event.pull_request.title}"

For more information see ${event.pull_request.html_url}

If you want to customize your message, you can see all the possible parameters by clicking the list icon (next to the 😀). Now your configuration should like something like:

Click “Run with Test Event” to try out your workflow

Now you can click “Run with Test Event” to test your workflow with sample data. You’ll get a text like the following:

A totally real pull request

Minute 4: Ship your Workflow!

After running your workflow successfully in the last step, the blue “Next” button on the bottom right should be enabled, click it to proceed.

After clicking “Next”, you’ll see this screen:

Name your Project

The name of your Project should be automatically generated, along with the filename in which we’ll store our code-based workflow. Click “Alright, Ship it!” to proceed. You’ll see the following prompt:

Click View Project to proceed

That’s it! Your workflow is live. Open a pull request in a repo that the app has access to and you’ll receive a similar message, with real data.

Minute 5: Customizing your Workflow

Once you click “View Project”, you’ll be brought to a project management screen. From here you can do all sorts of cool things — you can learn more about modifying workflows in our documentation.

Click “dev (click to manage)”

For now, click “dev (click to manage)” to see your workflow development environment. You’ll see a summary of your workflow project and the API actions it’s taking.

Click “Edit Code” to modify workflow code

From here, we can edit this workflow code by clicking “Edit Code” to open up Code on Standard Library, Standard Library’s in-browser editor.

Editing your workflow

To workflow code, make any changes you want and click “Up” (the blue button in the bottom right). For example, you might want to change your handler to send the message to multiple phone numbers:

This handler sends a message to all numbers in the PHONE_NUMBERS array.

With that code, your handler will iterate over the numbers in PHONE_NUMBERS and send a message for each one. After you copy and paste the code and click “Up” you can go back to your project management page to trigger a test event.

Click “Test” to trigger a test event

That’s it!

In just a few minutes, you set up a way to forward pull requests from GitHub to your phone. As you just saw, you have full control when customizing your workflow with code. You can configure it do just about anything.

Thanks for reading and happy building! You can follow us for more updates on Twitter at @StdLibHQ or check out our blog, https://stdlib.com/blog for frequent updates. For additional help, see our documentation, or join our Slack workspace by visiting https://docs.stdlib.com/ and clicking “Request Slack Community Invitation” on the right.