Introduction

While working on a repository which is shared across multiple developers sometimes it becomes necessary that an issue needs to be created for the owner of the repository to track and to assign it to a concerned party. This task is manual and the owner/administrator needs to go to GITHub to check and assign the issue and similarly, the developers also need to create the issue in the GIT. If this process can be automated intelligently so as to create and assign the issues without human intervention, then it becomes beneficial to both the parties. This article aims to discuss the automation of issue creation using Logic Apps and LUIS.  The developers can send the mail to a target mailbox to create the issue and the Logic App workflow with the help of LUIS will intelligently understand the request and create the workflow.

↑ Back To Top


Basic Concepts

What are Logic Apps?

Logic Apps are a piece of integration workflow hosted on Azure which is used to create scale-able integrations between various systems. These are very easy to design and provide connectivity between various disparate systems using many out of the box connectors as well as with the facility to design custom connectors for specific purposes. This makes integration easier than ever as the design aspect of the earlier complex integrations is made easy with minimum steps required to get a workflow in place and get it running.

What is LUIS?

As per Microsoft 

"Language Understanding (LUIS) allows your application to understand what a person wants in their own words. LUIS uses machine learning to allow developers to build applications that can receive user input in natural language and extract meaning from it. A client application that converses with the user can pass user input to a LUIS app and receive relevant, detailed information back."

Key Concepts In LUIS

  1. Utterance: This is the actual command spoken/written by the User /APP
  2. Intents: Intents describes the actual intention behind the command given by the user.
    e.g. when the User says "Find me all the Push made on the PublicWorks Repository", what user wants is the list of the Push made on the PublicWorks repository, hence Push made is the intent here.
  3. Entity: This is extra information that is present in the utterance which helps the LUIS to understand the utterance more. In above e.g PublicWorks is the name of the repository and hence is the entity which gives the name of the repository on which the Push is to be queried.

↑ Back To Top


Design

The design of the flow can be divided into following subparts.

  1. Creating LUIS Application
  2. Registering LUIS app in Azure Portal
  3. Creating Logic App

Creating LUIS Application

Following are the step by step instructions to create the LUIS application. This LUSI application detects the intent in the Subject line and checks if the mail sender wants to create an issue. If so it will send the intent in the JSON response to the logic app.

  1. Log on to the LUIS portal() using Azure Credentials.
  2. Create a new application which will detect the necessary intents. 



  3. Select the newly created application from the list.
  4. Create a new simple entity called RepositoryNameEntity



  5. Create a new intent called CreateIssueIntent



  6. The entities are mapped to the intent for a few utterances as shown below.



  7. Once done, train the application and it can be tested using sample test data. Note that more the training data more intelligent application will be.
  8. This completes the creation of the LUIS application.

Registering LUIS Application in Azure Portal

In order to consume the LUIS app from the logic apps, the LUIS app must be published to the Resource group so that logic app connectors can use it, in order to do so, a LUIS cognitive services account need to be set up in the Azure. Refer to following steps to set up the account

  

Once an account for LUIS is created, the publication of the app becomes very easy.  Navigate to the Publish Tab in the LUIS portal and select the environment (Production/Staging) and the time zone. Click on Add key to publish the LUIS app in the region which has the LUIS cognitive account created above. The details will be auto populated.


  


  

Logic App

The logic app is very easy to set up. The logic app will monitor one mailbox on a recursive basis and with the help of the subject and the trained LUIS application will create an issue in GitHub if the subject line indicates so. Once the issue is created the logic app will reply back to the user with details of the issue created.

Following are the steps to create the logic app.

  1. Select the Logic App under integration in the basic blade.



  2. Fill out the necessary details like the name, resource group etc.



  3. Select the blank template to begin the creation of the logic app



  4. from the list of the available triggers select the Gmail:When a new Email Arrives trigger.Configure the gmail connections and set the frequency for the trigger to poll the Gmail inbox.





  5. From the List of available actions select the LUIS: Get Prediction action. Connect the Logic App to the necessary LUIS application and provide the Subject from the received email as the utterance.

      




  6. Initialize a variable to store the entity name.



  7. If the desired Intent value in the response from LUIS prediction is true means that the user has sent mail to create an issue on the repository. Configure the condition action in such manner.



  8. Set the value of the variable using the entity name which can be derived using a ParseJson action.



  9. From the list of available actions select the GitHub:"Create an issue in GitHub". Connect the logic app to the GitHub account and provide details like the owner name, the repository name can be provided from the entity that was parsed in the above step. The description of the issue will be the body of the email received.



  10. Once the issue is successfully created, in order to send out an acknowledgement with the issue details, from the list of available action, select Gmail:ReplyToEmail action. Configure the message id from the details of the mail received and body with the details from the Create Issue action response.



  11. In the false branch, no action is required at all.
  12. This completes the logic app design.

↑ Back To Top


Testing

Following is the request response email communication to and from the logic app. Same issue is created in GitHub also.

  

  

↑ Back To Top


Conclusion

From the above design, it can be concluded that it is very easy to set up an intelligent flow to create an issue in GitHub.

↑ Back To Top


See Also

Following links can be visited to learn about some of the applications of logic apps and the readers can try to implement them in Flow.

↑ Back To Top


References

Following article was referred to quote information about LUIS.

About Language Understanding (LUIS) 

↑ Back To Top