GitHub Integration

Trillo Workbench integrates with the GitHub. It is useful for storing code (metadata and functions) and for deployment in a new environment such as from development to staging, staging to production.
By default code is saved and versioned in the Trillo Workbench database (which is backed up regularly). The git integration has several benefits such as branching, peer review, pull requests, reporting, etc. Trillo Workbench also uses git for deployment of code from one environment to another. Once code is pushed from an environment, it can be deployed in a different environment by git pull.
Using git requires one time set up to link Trillo Workbench instance with the GitHub. It is described below. After that a user can perform push and pull.

Linking Trillo Workbench to GitHub

The linking Trillo WOrkbench and GitHub is a 3 steps process.
  1. 1.
    Create an OAuth application in GitHub.
  2. 2.
    Configuring Trillo Workbench with the GitHub credentials.
  3. 3.
    Connect and login to GitHub (using GitHub's login screen) so the Trillo Workbench can acquire a token for API calls.

Create an OAuth Application in GitHub

In order to use APIs of GitHub from the Trillo Workbench, you need to create an OAuth application to GitHub. It is explained in this documentation - Creating an OAuth application with GitHub. You will require the internet accessible URL of the Trillo Workbench to register your application.
The steps described in the document are repeated here for convenience. Even if they have changed since, the principles remain the same.
First login into your GitHub account and click on settings.
Click on the developer settings as shown below
Proceed to creating a new OAuth application
Enter the workbench URL (accessible over the internet) at two places as shown below.
Next generate the client secret as shown below.
Note down client ID and secret securely on your machine (recommended to delete then after entering into the workbench).

Configuring Trillo Workbench with GitHub Credentials

In order to configure Trillo Workbench you need following information:
  1. 1.
    GitHub credentials of the OAuth application created in previous step.
  2. 2.
    A name of repository in the GitHub. Let us use "MyApplication" as the name in the example below.
  3. 3.
    Enter these information in the form of Trillo Workbench UI shown below.
  4. 4.
    Enter 'Save'. It will save information securely in the Trillo Workbench server.
Configure Repo Name and GitHub Credentials into Trillo Workbench

Connect with GitHub

Once you configure Trillo Workbench with GitHub info, the Settings navigation item becomes visible. Select it and then click on Connect with Git Account. It will initiate the authorization workflow with GitHub to obtain an access token.
Clicking on Connect with Git Account will navigate you to the following login page on the GitHub website.
OAuth Authorization on GitHub using User's Login Information
Click on the Authorize saawan ('saawan' will be replaced by your GitHub id). Once you authorize, the control will be transferred back to the Trillo Workbench. Using the "code" provided in redirect URL, the Trillo Workbench will acquire an access token and redisplay its Git page. Now the Trillo Workbench page would look like as shown below.
Trillo Workbench Git Page after Linking Trillo Workbench with GitHub

Git Operation

Once the above setup is completed, users can perform git push and pull operations as shown below.

Git Push

A user can push code to the GitHub using the following screen. It will create a branch with your user id as the name of the branch. You can create a peer review request using GitHub UI and merge it.
Git Push by a User
Alternatively the can push through your branch create a pull request and merge the pull request into the master branch.
Push Code to a branch, Create PR and Merge it
Check your task history at the end of the operation the logs will be shown highlighting the details of this operation.
Checking operation in the Task History
You can check operation result on the GitHub by clicking on "Browse on GitHub"
GitHub Page showing code in your branch

Git Pull

Similar to Push, a user can initiate the Git Pull flow. The interaction for the Git Pull are simple. The Trillo Workbench asks for the confirmation of action and initiates a background task to pull the code from the connect Git repository into Trillo Workbench.
Since Git Pull overwrites code in the Trillo Workbench, this action is available only to a user with "admin" role.