GitHub Integration (via Microsoft Power Automate) - Merge a Pull Request

Last modified on 2022/11/08 13:22

About This Integration

IntegrationIntroduction

You can integrate third-party systems with Service Manager 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 do not hesitate to contact your EasyVista contact, 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 action in the timeline of a Service Manager ticket when a pull request is merged in GitHub, via Microsoft Power Automate.

  • The comment in the pull request is retrieved from GitHub.
  • A direct link to the pull request in GitHub is added.
             Ticket Service Manager - New action with pull request link.png

Note: GitHub and Service Manager are linked using a standard comment added to the pull request. This comment must include the Service Manager ticket number and the ID of the Azure DevOps Bug work item associated with the ticket.
  

Preview of the tools used in this integration

  • Microsoft Power Automate (formerly known as Microsoft Flow) 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 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

Definitions_GitHub
  • 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.
  • 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 that contains each source code.
  • Issues are created to initiate discussions among developers, bug reports, proposed developments, etc.
  • A pull request is a procedure that enables an external contributor to propose changes to the original code (request), integrate feedback and resubmit them (pull).
  • A review is used to evaluate, comment and validate the changed code in the pull request. Once code changes are approved by the review, the pull request is merged with the original version.

Microsoft Power Automate flows

The integration between Service Manager and GitHub will trigger a flow in Microsoft Power Automate when a pull request associated with a Service Manager ticket is merged.

==> Merge a pull request in GitHub flow
         Data feed diagram 1 - EN.png

Prerequisites

  • You must ask EasyVista to create two fields in the SD_REQUEST table which will be specific to Azure DevOps and GitHub.
  • You must add a standard comment to the pull request when it is merged. Open url.png See the procedure.

Best Practice

BestPractice
  • The procedure describes all of the steps for creating Microsoft Power Automate flows. To facilitate integration, the ZIP folders shipped with this integration contain pre-configured flows. Once you have downloaded them, you should specify the parameters specific to your environment, i.e. Azure account credentials, EasyVista server address, credentials of your Service Manager platform, etc.
  • Use the search field to find the connectors and actions to be created in the MS Power Automate workflow easily.

    example  Find the actions for the Azure DevOps connector

    Microsoft Power Automate - Best Practice search connector.png

Caution

Caution_TitleActionInPowerAutomateFlow
  • When you create workflow actions in Microsoft Power Automate, you must rename them as indicated in the procedure. This is because certain items of information in the name refer to the title of the action. If you do not respect the naming convention, the workflow will not be triggered correctly.

example  The split(body('Analyze_Ticket_Info')'')?['AVAILABLE_FIELD_6'],',') instruction refers to the action called Analyze Ticket Info

Note: Spaces in the title will automatically be replaced by the underscore _.

Integration process

 Prerequisite  Ask EasyVista to create two fields in the SD_REQUEST table which will be specific to Azure DevOps and GitHub. Add them to the ticket form. Open url.png See the detailed procedure.

1. Create the MS Power Automate flow that will be triggered when a pull request is merged. Open url.png See the detailed procedure.

  • Note: This requires a connection to GitHub.

Best Practice icon.png  Import the preconfigured flow below containing all of the steps to MS Power Automate. Open url.png See the procedure for importing flows.
        Download icon.png  Flow Merge a pull request in GitHub

2. Create a standard comment for the pull request when it is merged. Open url.png See the detailed procedure.

Note: You must add a standard comment each time a pull request associated with a Service Manager ticket is merged.

Step-by-Step Integration Process

AddDevOpsFieldsInTicketForm_Procedure

Add fields specific to Azure DevOps and GitHub to the SD_REQUEST table

Step 1: Ask EasyVista to add fields to the database

1. Ask EasyVista to add the following two fields.

  • Field called E_ADO_NUMBER, nvarchar data type, size 20. This will store the ID of the Azure DevOps work item associated with the Service Manager ticket.
  • Field called E_PR_NUMBER, nvarchar data type, size 20. This will store the number of the GitHub pull request associated with the Service Manager ticket.
     

Step 2: Add fields to the Ticket forms, i.e. Incident and Request forms

     Open url.png See the detailed procedure

1. Open each Ticket form, i.e. Incident and Request forms.

2. Click Browse grey points icon.png in the top banner and select Edit Form.
The main form presentation will appear.

3. Select and place the two fields in the form.

4. Click Save and click Save and Close.

The form will be refreshed.
         Add fields DevOps in ticket form.png

Import the workflow to Microsoft Power Automate

Note: This requires a connection to GitHub.

Step 1: Download the flow

1. Download the file below to your workstation.

        Download icon.png  Flow Merge a pull request in GitHub

ImportFlowInMicrosoftPowerAutomate_Procedure

Step 2: Import the flow to Microsoft Power Automate 

1. Log in to the Microsoft Power Automate website using your account credentials.

2. Click My flows in the left pane.

A list of your MS Power Automate flows will appear.
         Microsoft Power Automate - Import flow - Flow list.png

3. Click Import in the menu bar and select the file you downloaded.

  • Once imported, the package contents will appear.
  • The Red nok icon.png icon indicates that the connection for the resource was not found.
    Microsoft Power Automate - Import flow - Package content.png

 

Step 3: Create the connections required for the flow

1. Click the Select during import link in the Import Setup column for the relevant resource.

          Microsoft Power Automate - Import flow - Import setup link.png

The window for configuring the import will appear.
         Microsoft Power Automate - Import flow - Import setup window.png

2. Create a new connection for the resource or select an existing connection.

There is an existing connection for the resource

  • Select the connection.
  • Click Save.
    Microsoft Power Automate - Import flow - Import setup - Select existing connection.png

There is no existing connection for the resource

  • Click + Create.
    Microsoft Power Automate - Import flow - Import setup - Create connection.png
    • An MS Power Automate instance will appear in a new Web browser tab.
    • The list of existing connections will appear.
               Microsoft Power Automate - Import flow - Import setup - Create connection 2.png
  • Click + New connection.
  • Find the connection you want using the search field and select it from the list.

example  Find the GitHub connection

Microsoft Power Automate - Import flow - Import setup - Create connection 3.png

A window displaying the list of permissions to be granted to Microsoft Power Platform will appear.

  • Click Create to create the new connection.
  • Click Accept to accept the conditions and authorize Microsoft Power Platform access.
    • You will return to the tab displaying the list of MS Power Automate flows.
    • The new connection for the resource will appear in the list.

example  New GitHub connection

Microsoft Power Automate - Import flow - Import setup - New connection added.png

  • Close your Web browser tab.
    You will return to the tab displaying the details of the imported package.
  • Click Refresh List.
    The new connection for the resource will appear in the window for configuring the import.
             Microsoft Power Automate - Import flow - Import setup - Refresh list.png
  • Select the connection and click Save.
    The Black cross icon.png icon indicates that the connection for the resource has been correctly established.
             Microsoft Power Automate - Import flow - Import setup - New connection ok.png

3. Repeat the procedure for each connection required for the flow.
 

Step 4: Import package resources

1. Click Import.

          Microsoft Power Automate - Import flow - Button.png

The Green ok icon.png icon next to each package resource indicates that the flow has been correctly imported.
         Microsoft Power Automate - Import flow - Ok.png

Step 5: Configure package resources

Note: You should perform this step if a message at the top of the page informs you that package resources must be configured.

1. Click Save as new flow in the message displayed at the top of the page.

         Microsoft Power Automate - Import flow with error - Save as new flow.png

  • An MS Power Automate instance will appear in a new Web browser tab.
  • The workflow of the imported package will appear.
             Microsoft Power Automate - Import flow with error - Invalid connection.png

2. Click the action indicating an invalid connection.

The list of all existing connections for the selected type of resource will appear.
         Microsoft Power Automate - Import flow with error - Invalid connection - Select connection.png

2. Click the connection defined for the type of resource.

The properties of the action will appear. The properties displayed depend on the type of resource.

example  Unspecified properties for an action using the Azure DevOps resource

Microsoft Power Automate - Import flow with error - Invalid connection - Configure connection.png

3. Specify the connection information for the action.

example  Properties for an action using the Azure DevOps resource

  • Organization Name: Select the name of your organization.
  • Project Name: Select the name of your DevOps project.

4. Repeat the procedure for each action indicating an invalid connection.

5. Click Save.

  • The error message for the action will disappear.

example  Action for the Azure DevOps resource

Microsoft Power Automate - Import flow with error - Invalid connection - Configure connection ok.png

  • You have configured all of the connections required for the flow.
  • The workflow will be created.
             Microsoft Power Automate - Import flow - Success.png

 

Step 6:  Configure the workflow

1. Move your cursor over the name of the flow and click Edit icon.png.

          Microsoft Power Automate - Open flow.png

The workflow will appear.
         Microsoft Power Automate - Detail flow.png

2. See the procedure for configuring the imported flow.

Create the MS Power Automate flow

Description of the Merge a pull request in GitHub workflow

Azure flow description - Merge GitHub pull request.png
  • Step 1: Create the step that will trigger the flow
  • Step 3: Find the Service Manager ticket number when the merge date of the pull request is specified
    • Step 3.a: Define a condition to check if there is a merge date for the pull request
    • Step 3.b: Find the standard comment containing the Resources section when the merge date is specified
    • Step 3.c: Define a condition to retrieve the Resources section from the standard comment
    • Step 3.d: Define a condition to check if there is a Service Manager ticket number in the Resources section
  • Step 4: Create an action in the timeline of the Service Manager ticket when the RFC NUMBER variable contains a ticket number
  • Step 5: Save the configuration of the workflow


Step 1: Create the step that will trigger the flow

==> The flow is triggered when a pull request is merged in GitHub.

1. Create a When a Pull Request is created or modified action for triggering the workflow (GitHub connector > Triggers).

Microsoft Power Automate - Trigger - When a pull request is created or modified.png
  • Specify the information on the trigger.
    • Repository Owner: Name of the owner of the GitHub folder.
    • Repository Name: Name of the GitHub folder.
    • Webhook events: Enter the pull_request value.
  • Save the trigger.


Step 2: Initialize variables

1. Define the following variables by creating Initialize variable actions in the order listed below.

Microsoft Power Automate - Action - Initialize variable.png
Variable 1: To store the number of the Service Manager ticket
  • Specify the information on the action.
    • Name: Enter the RFC_NUMBER value.
    • Type: Select the String value.
Variable 2:
  • Specify the information on the action.
    • Name: Enter the URL value.
    • Type: Select the String value.
    • Value: Enter the following expression. Replace the values highlighted in yellow with the values of your Service Manager environment.
      https://{your_platform}/{your_account}/


Step 3: Find the Service Manager ticket number when the merge date of the pull request is specified


Step 3.a: Define a condition to check if there is a merge date for the pull request

1. Create a Condition action.

Flow Merge pull request - Condition if the PR is merged - Line condition.png
  • Rename it Condition if the PR is merged using Browse black points icon.png in the title bar.
  • Click Add to add the following line to the condition.
Value tested Condition line
Merge date specified
  • Select Value: Enter the instruction below.
    @triggerOutputs()?['body/pull_request/merged_at']
  • Comparator: Select is not equal to.
  • Value: Select the null value.

2. Define the actions to be performed when the merge date of the pull request is specified (condition for the Condition if the PR is merged action).

  • Go to the If Yes branch.
  • Add the actions from step 3.b by selecting Add an action.


Step 3.b: Find the standard comment containing the Resources section when the merge date is specified

          Flow Merge pull request - Condition if the PR is merged - Yes branch.png

1. Create a HTTP action to read all comments in the pull request.

Microsoft Power Automate - Action - HTTP Get with bearer token.png
  • Rename it HTTP Get Comments using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Method: Enter the GET value.
    • URI: Enter the following expression.
      concat(triggerOutputs()?['body/pull_request/issue_url'],'/comments')
    • Headers:
      • Left column: Enter the Authorization value.
      • Right column: Enter the Bearer XXXXXXX value by replacing XXXXXXX with the GitHub token bearer.

2. Create a JSON Analysis action to retrieve information on the comments.

Microsoft Power Automate - Action - Parse JSON.png
  • Rename it Parse JSON Get Comments using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Contents: Select the dynamic variable called Body from the HTTP Get Comments step.
    • Schema: Copy and paste the JSON schema below.

      Display the JSON schema

      {
         "type": "array",
         "items": {
             "type": "object",
             "properties": {
                 "url": {
                     "type": "string"
                  },
                 "html_url": {
                     "type": "string"
                  },
                 "issue_url": {
                     "type": "string"
                  },
                 "id": {
                     "type": "integer"
                  },
                 "node_id": {
                     "type": "string"
                  },
                 "user": {
                     "type": "object",
                     "properties": {
                         "login": {
                             "type": "string"
                          },
                         "id": {
                             "type": "integer"
                          },
                         "node_id": {
                             "type": "string"
                          },
                         "avatar_url": {
                             "type": "string"
                          },
                         "gravatar_id": {
                             "type": "string"
                          },
                         "url": {
                             "type": "string"
                          },
                         "html_url": {
                             "type": "string"
                          },
                         "followers_url": {
                             "type": "string"
                          },
                         "following_url": {
                             "type": "string"
                          },
                         "gists_url": {
                             "type": "string"
                          },
                         "starred_url": {
                             "type": "string"
                          },
                         "subscriptions_url": {
                             "type": "string"
                          },
                         "organizations_url": {
                             "type": "string"
                          },
                         "repos_url": {
                             "type": "string"
                          },
                         "events_url": {
                             "type": "string"
                          },
                         "received_events_url": {
                             "type": "string"
                          },
                         "type": {
                             "type": "string"
                          },
                         "site_admin": {
                             "type": "boolean"
                          }
                      }
                  },
                 "created_at": {
                     "type": "string"
                  },
                 "updated_at": {
                     "type": "string"
                  },
                 "author_association": {
                     "type": "string"
                  },
                 "body": {
                     "type": "string"
                  },
                 "reactions": {
                     "type": "object",
                     "properties": {
                         "url": {
                             "type": "string"
                          },
                         "total_count": {
                             "type": "integer"
                          },
                         "+1": {
                             "type": "integer"
                          },
                         "-1": {
                             "type": "integer"
                          },
                         "laugh": {
                             "type": "integer"
                          },
                         "hooray": {
                             "type": "integer"
                          },
                         "confused": {
                             "type": "integer"
                          },
                         "heart": {
                             "type": "integer"
                          },
                         "rocket": {
                             "type": "integer"
                          },
                         "eyes": {
                             "type": "integer"
                          }
                      }
                  },
                 "performed_via_github_app": {}
              },
             "required": [
                 "url",
                 "html_url",
                 "issue_url",
                 "id",
                 "node_id",
                 "user",
                 "created_at",
                 "updated_at",
                 "author_association",
                 "body",
                 "reactions",
                 "performed_via_github_app"
              ]
          }
      }


Step 3.c: Define a condition to retrieve the Resources section from the standard comment

          Flow Merge pull request - Condition if the PR is merged - Apply to each detail.png

1. Create an Apply to each action.

Flow Merge pull request - Condition if the PR is merged - Apply to each action.png
  • Specify the information on the action.
    • Select an output from previous steps: Enter the instruction below.
      @{body('Parse_JSON')}

2. Create a HTTP action to read each comment in the pull request.

Microsoft Power Automate - Action - HTTP Get with bearer token.png
  • Rename it HTTP Get a comment using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Method: Enter the GET value.
    • URI: Enter the following expression.
      @{items('Apply_to_each')['url']}
    • Headers:
      • Left column: Enter the Authorization value.
      • Right column: Enter the Bearer XXXXXXX value by replacing XXXXXXX with the GitHub token bearer.

3. Create a JSON Analysis action to retrieve information on the comment.

Microsoft Power Automate - Action - Parse JSON.png
  • Rename it Parse JSON Get a comment using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Contents: Select the dynamic variable called Body from the HTTP Get a comment step.
    • Schema: Copy and paste the JSON schema below.

      Display the JSON schema

      {
         "type": "object",
         "properties": {
             "url": {
                 "type": "string"
              },
             "html_url": {
                 "type": "string"
              },
             "issue_url": {
                 "type": "string"
              },
             "id": {
                 "type": "integer"
              },
             "node_id": {
                 "type": "string"
              },
             "user": {
                 "type": "object",
                 "properties": {
                     "login": {
                         "type": "string"
                      },
                     "id": {
                         "type": "integer"
                      },
                     "node_id": {
                         "type": "string"
                      },
                     "avatar_url": {
                         "type": "string"
                      },
                     "gravatar_id": {
                         "type": "string"
                      },
                     "url": {
                         "type": "string"
                      },
                     "html_url": {
                         "type": "string"
                      },
                     "followers_url": {
                         "type": "string"
                      },
                     "following_url": {
                         "type": "string"
                      },
                     "gists_url": {
                         "type": "string"
                      },
                     "starred_url": {
                         "type": "string"
                      },
                     "subscriptions_url": {
                         "type": "string"
                      },
                     "organizations_url": {
                         "type": "string"
                      },
                     "repos_url": {
                         "type": "string"
                      },
                     "events_url": {
                         "type": "string"
                      },
                     "received_events_url": {
                         "type": "string"
                      },
                     "type": {
                         "type": "string"
                      },
                     "site_admin": {
                         "type": "boolean"
                      }
                  }
              },
             "created_at": {
                 "type": "string"
              },
             "updated_at": {
                 "type": "string"
              },
             "author_association": {
                 "type": "string"
              },
             "body": {
                 "type": "string"
              },
             "reactions": {
                 "type": "object",
                 "properties": {
                     "url": {
                         "type": "string"
                      },
                     "total_count": {
                         "type": "integer"
                      },
                     "+1": {
                         "type": "integer"
                      },
                     "-1": {
                         "type": "integer"
                      },
                     "laugh": {
                         "type": "integer"
                      },
                     "hooray": {
                         "type": "integer"
                      },
                     "confused": {
                         "type": "integer"
                      },
                     "heart": {
                         "type": "integer"
                      },
                     "rocket": {
                         "type": "integer"
                      },
                     "eyes": {
                         "type": "integer"
                      }
                  }
              },
             "performed_via_github_app": {}
          }
      }

4. Create a Condition action to check if there is a Resources section among the information retrieved in the Parse JSON Get a comment step.

Flow Merge pull request - Condition if comment is EZV - Line condition.png
  • Rename it Condition if comment is EZV using Browse black points icon.png in the title bar.
  • Click Add to add the following line to the condition.
Value tested Condition line
Resources section found
  • Select Value: Enter the instruction below.
    substring(body('Parse_JSON_Get_a_comment')?['body'],3,9)
  • Comparator: Select is equal to.
  • Value: Enter the Resources value.

5. Define the actions to be performed when the Resources section is found (condition for the Condition if comment is EZV action).

  • Go to the If Yes branch.
  • Add the actions from step 3.d by selecting Add an action.


Step 3.d: Define a condition to check if there is a Service Manager ticket number in the Resources section

          Flow Merge pull request - Condition if comment is EZV - Yes branch.png

1. Define the following Compose actions in the order listed below to break down the contents of the Resources section.

Microsoft Power Automate - Action - Compose.png
Compose 1:
  • Rename the action Compose[ using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Inputs: Enter the instruction below.
      @{add(int(indexOf(body('Parse_JSON_Get_a_comment')?['body'],'[')),1)}
Compose 2:
  • Rename the action Compose] using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Inputs: Enter the instruction below.
      int(indexOf(body('Parse_JSON_Get_a_comment')?['body'],']'))
Compose 3:
  • Rename the action Compose Last using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Inputs: Enter the instruction below.
      sub(outputs('Compose_]'),outputs('Compose_['))
Compose 4:
  • Rename the action Compose Final using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Inputs: Enter the instruction below.
      @{substring(body('Parse_JSON_Get_a_comment')?['body'],outputs('Compose_['),outputs('Compose_Last'))}

2. Create a Set variable action to store the Service Manager ticket number in the RFC NUMBER variable.

Microsoft Power Automate - Action - Set variable.png
  • Rename it Set variable RFC_NUMBER using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Name: Enter the RFC_Number value.
    • Value: Enter the instruction below.
      @Outputs('Compose_Final')

3. Create a Condition action to check if there is a Service Manager ticket number in the RFC NUMBER variable.

Flow Merge pull request - Condition if there is a RFC Number - Line condition.png
  • Rename it Condition if there is a RFC Number using Browse black points icon.png in the title bar.
  • Click Add to add the following lines to the condition.
Value tested Condition line
RFC NUMBER variable specified
  • Select Value: Enter the instruction below.
    @variables('RFC_NUMBER')
  • Comparator: Select is not equal to.
  • Value: Select the null value.
RFC NUMBER variable specified
  • Select Value: Enter the instruction below.
    @variables('RFC_NUMBER')
  • Comparator: Select is not equal to.
  • Value: Select the "" value.
RFC NUMBER variable = XXX
  • Select Value: Enter the instruction below.
    @variables('RFC_NUMBER')
  • Comparator: Select is not equal to.
  • Value: Select the XXX value.

4. Define the actions to be performed when the RFC NUMBER variable contains a Service Manager ticket number (conditions for the Condition if there is a RFC Number action).

  • Go to the If Yes branch.
  • Add the actions from step 4 by selecting Add an action.


Step 4: Create an action in the timeline of the Service Manager ticket when the RFC NUMBER variable contains a ticket number

          Flow Merge pull request - Condition if there is a RFC Number - Yes branch.png

1. Create a HTTP action to find the Service Manager ticket corresponding to the RFC NUMBER variable.

Microsoft Power Automate - Action - HTTP Get.png
  • Rename it HTTP Get Group ID using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Method: Enter the GET value.
    • URI: Enter the following expression. Replace the values highlighted in yellow with the values of your Service Manager environment.
      concat('{your_platform}/api/v1/{your_account}/actions?search=request.rfc_number:',variables('RFC_NUMBER'),',end_date_ut:"is_null"&fields=group_id&sort=action_id+desc&max_rows=1')

2. Create a JSON Analysis action to retrieve information on the Service Manager ticket.

Microsoft Power Automate - Action - Parse JSON.png
  • Rename it Parse JSON Get Group ID using Browse black points icon.png in the title bar.
  • Specify the information on the action.
    • Contents: Select the dynamic variable called Body from the HTTP Get a comment step.
    • Schema: Copy and paste the JSON schema below.

      Display the JSON schema

      {
         "type": "object",
         "properties": {
             "HREF": {
                 "type": "string"
              },
             "record_count": {
                 "type": "string"
              },
             "total_record_count": {
                 "type": "string"
              },
             "records": {
                 "type": "array",
                 "items": {
                     "type": "object",
                     "properties": {
                         "HREF": {
                             "type": "string"
                          },
                         "ACTION_ID": {
                             "type": "string"
                          },
                         "GROUP_ID": {
                             "type": "string"
                          }
                      },
                     "required": [
                         "HREF",
                         "ACTION_ID",
                         "GROUP_ID"
                      ]
                  }
              }
          }
      }

3. Create an Apply to each action.

Flow Merge pull request - Condition if there is a RFC Number - Apply to each action.png
  • Specify the information on the action.
    • Select an output from previous steps: Enter the instruction below.
      @{body('Parse JSON Get Group ID')?['records']}

4. Create a HTTP action to define a Merge a pull request action in the timeline of the Service Manager ticket.

Flow Merge pull request - Condition if there is a RFC Number - Apply to each detail.png
  • Rename it Send to EZV using Browse black points icon.png in the title bar.
  • Specify the information on the action.* Method: Enter the POST value.
    • URI: Enter the following expression.
      concat(variables('URL'),'requests/',variables('RFC_Number'),'/tasks')
    • Body: Copy and paste the JSON schema below.
      { "comment": "Merge PR @{triggerOutputs()?['body/pull_request/number']} < br> @{triggerOutputs()?['body/pull_request/html_url']}", "action_type_id": "95", "group_id": "64" }


Step 5: Save the configuration of the workflow

1. Click Save at the bottom of the flow.

          Azure flow - Save configuration.png

Create the standard comment for the pull request

Note: You must add a standard comment each time a pull request associated with a Service Manager ticket is merged.

CreatePullRequestTypeComment_Procedure

Step 1: Log in to GitHub

1. Log in to GitHub using your account credentials.

2. Select the account of the GitHub repository owner and the GitHub repository where the pull request is committed.

          GitHub - Pull request create type comment - Connection.png
 

Step 2: Find the pull request

1. Select the Pull requests tab.

The list of pull requests will appear.
         GitHub - Pull request create type comment - Pull request list.png

2. Click the pull request to be processed.

The actions that can be performed on the pull request will appear.
 

Step 3: Create the standard comment for the pull request

1. Click Comment at the bottom of the pull request.

          GitHub - Pull request create type comment.png

2. Enter the following standard comment in the Write tab. Replace the values highlighted in yellow with your values.

  • RXXXXXX_XXXXXX: Number of the Service Manager ticket
  • ID_Azure: Azure DevOps Bug work item associated with the ticket

## Resources
| Resource | URL |
|------------------------|:----------------:|
| Ticket number | [RXXXXXX_XXXXXX](https://autoconnect_link) |
| ADO | [ID Azure](https://dev.azure.com/Organization/Project_Name/_workitems/edit/ID_Azure) |

3. Click Comment.

The comment will automatically be refreshed in the pull request. It displays the number of the Service Manager ticket and the ID of the associated Azure DevOps Bug work item.
         GitHub - Pull request create type comment - Result.png

Links to other integrations

List of files to download

Note: To find out more, see the step-by-step integration process.

         Download icon.png  Flow Merge a pull request in GitHub

Tags:
Powered by XWiki © EasyVista 2022