A few weeks ago, we were considering whether the current approach works for us and how we can improve the workflow. The previous pipeline has not worked well and we decided to create a new one from scratch. I will not be writing about the whole workflow, it is not a part of topic but I'm going to tell you about one specific step in our pipeline. To solve our problem we will use a single event which comes from Github when pull request has been approved. The event triggers workflow on Bitrise. Unfortunately, Bitrise doesn't allow you to recognize the distinctions between pull request update or pull request approval.
We used feature branch workflow. That means, a developer can create a branch for new feature and start working on it. When done, they create PR waiting for review and after review they merge the feature branch to master. There is one problem here - we keep on master the changes that might cause regression because nobody checked it before (QA). We don't want to create additional develop branch that allows us to keep the code stable on master branch because the issue will move from master to develop branch and won't disappear.
The solution comes with Google Cloud Function but before lets see what Bitrise brought. Bitrise has a way to start a build manually. After navigating to your project and clicking on Start/Schedule Build you will see a dialog. This lets you configure a build and set certain parameters such as branch name, message, and workflow. Take a look at the Advanced tab and scroll to the bottom.
Notice that we are able to perform curl command that runs our build configuration. We can use it and create function which does this automatically. Keep APP_ID, TOKEN and WORKFLOW name for the next step.
Google Cloud Function
Now we can move to Google Cloud Function console and select our existing project or create the other one following their guide. The dashboard contains list of cloud function, lets go then and create a basic cloud function. The details view allows you to choose runtime environment for the function. Below you can find a source code which you can deploy using Firebase CLI or just copy and paste to a cloud function dashboard.