GitHub Integration (via Microsoft Power Automate)


About This Integration

IntegrationIntroduction

You can integrate third-party systems with Product name - ev itsm.png in many ways. The method you select will depend on business requirements, architectural and security constraints as well as the characteristics specific to each third-party application or service.

This document describes an integration process that has already been implemented in a customer context. 

To find out more about this integration (e.g. scripts to be used), please contact the Logo - EasyVista.png Consulting & Professional Services team, the Logo - EasyVista.png Support team, or your service provider and integrator.
 

Overview of the integration

GitHub is an online service that hosts websites and source code files, and provides distributed version control using Git. It is also a collaborative space where each user can contribute content to online public projects.

This integration enables you to create an issue in GitHub when you receive a Service Manager change request associated with a release project, using Microsoft Power Automate (formerly known as Microsoft Flow). MS Power Automate workflows are created in Microsoft Azure Logic Apps using the EasyVista Service Manager connector to retrieve the change request and the GitHub connector to associate a GitHub issue with the request.
 

Preview of the tools used in this integration

  • Microsoft Azure Logic Apps enables you to integrate and connect hundreds of on-premises or cloud-based applications and Web services, data and devices easily.
  • Microsoft Power Automate enables you to automate recurrent tasks by building workflows using Web applications. These applications use MS Power Automate connectors (based on Microsoft Azure Logic Apps) or the MS Graph gateway for interfacing with any endpoint via HTTP/HTTPS.
     
Integration Data Feed (direction) Authentication Type Integration Connector Options

Logo - EV Service Manager.png

Down arrow.png

Logo Icon - Microsoft Flow.png

Down arrow.png

Logo Icon - GitHub.png

Down arrow.png

Logo Icon - Microsoft Flow.png

Down arrow.png

Logo - EV Service Manager.png

  • Depending on the third-party service used (authentication managed by Logic Apps)
  • Basic Authentication for the Service Manager REST API
  • Service Manager:

    EV Integration connector icon - Workflow.png    Workflows

    EV Integration connector icon - Business rule.png    Business rules

    *MS Power Automate:

    EV Integration connector icon - Receive.png    Connector: When a HTTP request is received

    (Service Manager trigger => Logic Apps)

Available versions
SaaS-based On-premises
Service Manager Check icon.png Check icon.png
Third-Party Product Check icon.png N/A

GitHub - definitions

  • Git is a distributed version control system for tracking project changes and saving them in different versions, thus enabling you to revert back to an older version at any time.
  • In Git, the copy of all project files and versions is called a repository. This is a storage space on the centralized GitHub server.
  • Issues are created to initiate discussions among developers, bug reports, proposed developments, etc.

Microsoft Azure Logic Apps flows

In GitHub, you create an issue following a change request in Service Manager through two workflows in Microsoft Azure Logic Apps.

MS Power Automate workflow 1: Create the issue in GitHub MS Power Automate workflow 2: Close the Service Manager request
Data feed diagram 1 - EN.png Data feed diagram 2 - EN.png

Step-by-Step Integration Process

In GitHub, you create an issue following a change request in Service Manager in the following steps:

Prerequisites

Best Practice

  • The procedure describes all of the steps for creating the two Microsoft Azure Logic Apps flows. To facilitate integration, the ZIP folders shipped with this integration contain two pre-configured flows. You should specify the parameters specific to your environment, i.e. Azure account credentials, EasyVista server address, login information of your Service Manager platform, etc.

Microsoft Azure Logic Apps: Create MS Power Automate workflow 1

Description of the workflow Create an issue in GitHub
         Azure flow description - Creation GitHub issue.png

Best Practice icon.png  Download the file below containing the pre-configured flow. Once you have imported it to Microsoft Azure Logic Apps, you can adapt it to your requirements using the procedure below. This procedure describes all of the steps for creating the workflow.

       Download icon.png  Flow Create an issue in GitHub

Step 1: Create the step that will trigger the workflow.

==> The workflow is triggered when a change request is associated with a release project in Service Manager.

1. Log in to the Azure portal using your Azure account login.

2. Create a new logic app. Open the Logic App Designer.
         Open url.png See Microsoft Azure Logic Apps integration for details on the procedure.

3. Create a When a HTTP request is received step for triggering the workflow.

         Action Azure - Creation GitHub issue - When a http request is received.png

4. Specify the information on the trigger.

  • Body: Copy and paste the JSON schema below.

    Display the JSON schema

    {
       "$id": "http://example.com/example.json",
       "type": "object",
       "definitions": {},
       "$schema": "http://json-schema.org/draft-07/schema#",
       "properties": {
           "Description": {
               "$id": "/properties/Description",
               "type": "string",
               "title": "Description",
               "default": "",
               "examples": [
                   "{Description}"
                ]
            },
           "id": {
               "$id": "/properties/id",
               "type": "string",
               "title": "Id",
               "default": "",
               "examples": [
                   "{id}"
                ]
            },
           "Host": {
               "$id": "/properties/Host",
               "type": "string",
               "title": "Host",
               "default": "",
               "examples": [
                   "{Host}"
                ]
          
     },
           "URL": {
               "$id": "/properties/URL",
               "type": "string",
               "title": "URL",
               "default": "",
               "examples": [
                   "{URL}"
                ]
            },
           "Account": {
               "$id": "/properties/Account",
               "type": "string",
               "title": "Account",
               "default": "",
               "examples": [
                   "{Account}"
                ]
            }
        }
    }
  • Method: Select the POST value.

5. Save the trigger.

  The following information will be retrieved from Service Manager: Ticket description, ticket ID, Host, URL, Account.

6. Click Copy icon.png to copy the URL displayed in the HTTP POST URL field and paste it in your text editor in order to store it temporarily. It will be required when defining the configuration in Service Manager (steps 2 and 4).

Step 2: Convert the description of the Service Manager request to plain text.

1. Create a HTML to text step.

         Action Azure - Creation GitHub issue - Html to text.png

2. Specify the Content field by selecting the dynamic value called Description from the When a HTTP request is received step for triggering the workflow.

Step 3: Create the issue in GitHub.

1. Search for the GitHub connector and select the Create an issue action.

Best Practice icon.png  Use the search field to find the connector and action you want quickly.

         Action Azure - Creation GitHub issue - Select GitHub connector.png

2. Log in to your GitHub account and click Sign in.

         Action Azure - Creation GitHub issue - GitHub connexion.png

The repositories associated with your account will become accessible in MS Power Automate.

3. Specify the GitHub login information and the Service Manager request.

  • Repository Owner: GitHub login.
  • Repository Name: Repository where the GitHub issue should be created.
  • Title: ID of the Service Manager request. Select the dynamic value called Id from the When a HTTP request is received step for triggering the workflow.
  • Body: Description of the Service Manager request in plain text. Select the dynamic value called The plain text content. This contains the results of the HTML to text step.
             Action Azure - Creation GitHub issue - Information.png

5. Save the workflow.

Microsoft Azure Logic Apps: Create MS Power Automate workflow 2

Description of the workflow Close the Service Manager request
         Azure flow description - GitHub issue closing.png

Best Practice icon.png  Download the file below containing the pre-configured flow. Once you have imported it to Microsoft Azure Logic Apps, you can adapt it to your requirements using the procedure below. This procedure describes all of the steps for creating the workflow.

       Download icon.png  Flow Close the Service Manager request

Step 1: Create the step that will trigger the workflow.

==> The workflow is triggered when the GitHub issue associated with the Service Manager change request is closed.

1. Search for the GitHub connector and select the When an issue assigned to me is closed trigger.

Best Practice icon.png  Use the search field to find the connector and trigger you want quickly.

         Action Azure - GitHub issue closing - When an issue assigned to me is closed - Selection trigger.png

The step for triggering the workflow is created. No parameter is required.
         Action Azure - GitHub issue closing - When an issue assigned to me is closed.png

Step 2: Retrieve the closing comment for the GitHub issue.

1. Create a HTTP step.

2. (optional) Click Browse black points icon.png in the title bar to rename the step so you can identify it easily.

example Pulling comment from GitHub

         Action Azure - GitHub issue closing - HTTP action - Pulling comment - Rename action.png

3. Enter the information for the step.

  • Method: Enter the GET value.
  • URI: Enter the following formula. Replace the values highlighted in yellow with the values of your GitHub account.

    concat(concat('https://api.github.com/repos/{your_repository_owner}/{your_repository_name}/issues/', triggerBody()?['number']),'/comments')

  • Headers:
    • Enter the first row with the following values.
      • Key: Content-Type
      • Value: application/json
    • Enter the second row with the following values.
      • Key: Authorization
      • Value: token {your_GitHub_token}. Replace the value highlighted in yellow with the token of your GitHub issue.

         Action Azure - GitHub issue closing - HTTP action - Pulling comment.png

4. Define the Message variable that will retrieve the comment for the closed GitHub issue. Create the following actions in the order listed below.

Action Details
4.a Create an Initialize variable action.

Action Azure - GitHub issue closing - Initialize variable Body - Information.png

  • Name: Variable name.

    example   Body

  • Type: Select the String value.
  • Value: Select the dynamic value called Body from the HTTP > Pulling comment from GitHub step.
4.b Create an Initialize variable action.

Action Azure - GitHub issue closing - Initialize variable Body array - Information.png

  • Name: Variable name.

    example   Body array

  • Type: Select the Array value.
  • Value: Enter the following formula.
    split(variables('Body'),';')
4.c Create a Message action.

Action Azure - GitHub issue closing - Compose Body array - Information.png

  • Inputs: Enter the following formula.
    last(variables('Body array'))
4.d Create an Initialize variable action.

Action Azure - GitHub issue closing - Initialize variable Message array - Information.png

  • Name: Variable name.

    example   Message array

  • Type: Select the Array value.
  • Value: Enter the following formula.
    split(outputs('Compose'),'"')
4.e Create an Initialize variable action.

Action Azure - GitHub issue closing - Initialize variable Message - Information.png

  • Name: Variable name.

    example   Message

  • Type: Select the String value.
  • Value: Enter the following formula.
    variables('Message array')[3]

Step 3: Store the closing comment of the GitHub issue in the Service Manager request.

1. Search for the EasyVista Service Manager connector and create an Update Request-Incident action.

Best Practice icon.png  Use the search field to find the connector and trigger you want quickly.

         Action Azure - Update request - Selection action.png

2. Specify the information on the action.

  • Account: Specify your account for accessing Service Manager.
  • Unique identification of request or incident: ID of the Service Manager request. Select the dynamic value called Title from the When an issue assigned to me is closed step for triggering the workflow.
  • Comment: Closing comment for the GitHub issue. Select the dynamic value called Message from the results of the Initialize variable > Message step.

         Action Azure - Update request - Information.png

Step 4: Close the Service Manager request.

1. Search for the EasyVista Service Manager connector and create a Close Request-Incident action.

2. Specify the information on the action.

  • Account: Specify your account for accessing Service Manager.
  • Unique identification of request or incident: ID of the Service Manager request. Select the dynamic value called Title from the When an issue assigned to me is closed step for triggering the workflow.
  • Closed comment: Closing comment for the GitHub issue. Select the dynamic value called Title from the When an issue assigned to me is closed step and the dynamic value called Message from the results of the Initialize variable > Message step.

         Action Azure - Close request - Information.png

3. Save the workflow.

Service Manager: Create a resource called GitHub issue used in a REST step in the ticket creation process

Step 1: Manage rights for using the Service Manager REST API.

    Open url.png See the description of profiles.

1. Select Administration > Access Management > User Profiles in the menu.

2. Select a user profile authorized to use the REST API.

3. Tick the REST API box.
Your modifications will automatically be saved.

4. Repeat the procedure for all authorized profiles.

Step 2: Create a GitHub issue resource associated with a Microsoft Power Automate service.

       Open url.png See How to define a new resource and associate it with a REST action.

1. Select Administration > REST > Services in the menu.

2. Create a new service.
         Service Manager - Microsoft Flow Service.png

  • Service Name: Microsoft Power Automate.
  • Authentication Method: None.
  • Service URL: URL for accessing the new Microsoft Power Automate service.
    •  Copy and paste the URL you stored in your text editor when creating the MS Power Automate workflow Create an issue in GitHub in Logic Apps (step 1).
    • You should keep only the text displayed in yellow below.

      https://prod-55.westeurope.logic.azure.com:443/workflows/a903f9140a874277be8b9dd39b5c4305/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=R-FJw5q_MEn-I-98MNF794bVtN91QIWFt8gixg-8

    • Replace prod-55.westeurope with {subdomain}.
       

3. Create a connection to the Microsoft Power Automate service.
         Service Manager - Microsoft Flow Connection.png

  • Connection Name: GitHub Flow.
  • Authentication Method: None.
  • Service Name: The Microsoft Power Automate service you created earlier.
    The URL of the Microsoft Power Automate service will automatically appear.
  • subdomain: Copy and paste the prod-55.westeurope value of the URL you stored in your text editor.
     

4. Create a resource associated with the Microsoft Power Automate service that will enable access to GitHub issues.
         Service Manager - Microsoft Flow Resource.png

  • Label: Name of the resource.
  • Resource URI: ID of the new resource.
    •  Copy and paste the URL you stored in your text editor when creating the MS Power Automate workflow Create an issue in GitHub in Logic Apps (step 1).
    • You should keep only the text displayed in yellow below.

      https://prod-55.westeurope.logic.azure.com:443/workflows/a903f9140a874277be8b9dd39b5c4305/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=R-FJw5q_MEn-I-98MNF794bVtN91QIWFt8gixg-8

  • Content: Body of the request containing the data to be updated. Copy and paste the text below without inserting any spaces or line breaks.

    Note: If you paste a JSON schema copied from a third-party editor such as Microsoft Word, Notepad++, etc., invisible characters may be inserted. This will create an error in the processing of the REST step using the resource.

    {"Description": "{Description}","id": "{id}","Host": "{sys.EVSM_HOST}","URL": "{sys.EVSM_REST_SERVICE_URL}","Account": "{sys.EVSM_ACCOUNT}"}

Step 3: Use the resource called GitHub issue in a REST step in the ticket creation process.

       Open url.png See How to define a new resource and associate it with a REST action.

1. Open the workflow or the business rule-related process you want.

  • Workflow: References > Other References > Workflows (Operation/Transition)
  • Business rule: Administration > Business Rules > Related Processes

2. Click and drag the new resource from the REST Actions category to the graphic editor of the process.
A new step will be added to the process.

3. Double-click to define the properties of the new step.

Links to other integrations

Tags:
Last modified by Unknown User on 2020/09/11 10:55
Created by Administrator XWiki on 2020/09/11 10:55

Shortcuts

Powered by XWiki ©, EasyVista 2020