GitHub Integration (via Microsoft Power Automate) - Close a Service Manager Ticket Linked to a Pull Request
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 check if the pull request associated with a Service Manager ticket is merged when the ticket is closed, via Microsoft Power Automate.
- A notification email is sent to the user in charge of the pull request if it is not merged.
- A direct link to the pull request in GitHub is added.
- Note: Once the user in charge has merged the pull request in GitHub, a new Microsoft Power Automate flow will automatically be triggered. This will create an action in the timeline of the Service Manager ticket.
See GitHub integration (via Microsoft Power Automate) - Merge a pull request.
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 | ||
---|---|---|---|---|
|
|
|
Available versions | ||
---|---|---|
SaaS-based | On-premises | |
Service Manager | ![]() |
![]() |
Third-Party Product | ![]() |
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 Service Manager ticket associated with a pull request is closed.
==> Close a ticket flow
Prerequisites
- You must have an Azure subscription. If this is not the case, you can create a free account, or you can buy an Azure Pay-As-You-Go subscription.
- You must have a GitHub account and an Office 365 Outlook account.
- You must ask EasyVista to create two fields in the SD_REQUEST table which will be specific to Azure DevOps and GitHub.
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 Send email action for the Office 365 Outlook connector
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
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. See the detailed procedure.
In Azure DevOps
1. Create the MS Power Automate flow that will be triggered when a Service Manager ticket is closed. See the detailed procedure.
In Service Manager
2. Create a dedicated resource called Merge Pull Request used in a REST step of a process. See the detailed procedure.
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
See the detailed procedure
1. Open each Ticket form, i.e. Incident and Request forms.
2. Click 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.
Import the workflow to Microsoft Power Automate
Step 1: Download the flow
1. Download the file below to your workstation.
Flow
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.
3. Click Import in the menu bar and select the file you downloaded.
- Once imported, the package contents will appear.
- The
icon indicates that the connection for the resource was not found.
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.
The window for configuring the import will appear.
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.
There is no existing connection for the resource
- Click + Create.
- An MS Power Automate instance will appear in a new Web browser tab.
- The list of existing connections will appear.
- Click + New connection.
- Find the connection you want using the search field and select it from the list.
example Find the GitHub connection
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
- 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.
- Select the connection and click Save.
Theicon indicates that the connection for the resource has been correctly established.
3. Repeat the procedure for each connection required for the flow.
Step 4: Import package resources
1. Click Import.
The icon next to each package resource indicates that the flow has been correctly imported.
Step 5: Configure package resources
1. Click Save as new flow in the message displayed at the top of the page.
- An MS Power Automate instance will appear in a new Web browser tab.
- The workflow of the imported package will appear.
2. Click the action indicating an invalid connection.
The list of all existing connections for the selected type of resource will appear.
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
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
- You have configured all of the connections required for the flow.
- The workflow will be created.
Step 6: Configure the workflow
1. Move your cursor over the name of the flow and click .
The workflow will appear.
2. See the procedure for configuring the imported flow.
Create the MS Power Automate flow
Description of the Close a Service Manager ticket associated with a pull request workflow
![]() |
|
Step 1: Create the step that will trigger the flow
==> The flow is triggered when a Service Manager ticket is closed.
1. Create a When a HTTP request is received action to trigger the workflow (Triggers).
![]() |
|
Step 2: Retrieve the Service Manager ticket
1. Create a HTTP action to find the Service Manager ticket.
![]() |
|
2. Create a JSON Analysis action to retrieve information on the Service Manager ticket.
![]() |
|
Step 3: Find the merge date of the pull request when the Service Manager ticket is associated with a pull request
Step 3.a: Define a condition to check if there is a pull request associated with the Service Manager ticket
3. Create a Condition action to check if there is a pull request number in the Service Manager ticket.
![]() |
|
3. Define the actions to be performed when the pull request number is specified (condition for the Condition if there is a PR action).
- Go to the If Yes branch.
- Add the actions from step 3.b by selecting Add an action.
Step 3.b: Define a condition to check if there is a merge date for the pull request
1. Create a Get a Pull Request action to read the pull request number stored in the E_PR_NUMBER field.
![]() |
|
2. Create a Condition action to check if there is a merge date for the pull request.
![]() |
|
3. Define the actions to be performed when the merge date of the pull request is unspecified (condition for the Condition PR is merged action).
- Go to the If Yes branch.
- Add the actions from step 4 by selecting Add an action.
Step 4: Send a notification email to the user in charge of the pull request if it is not merged
1. Create a Send an email (V2) action (Office 365 Outlook connector) to create an email.
![]() |
|
Step 5: Save the configuration of the workflow
1. Click Save at the bottom of the flow.
Service Manager: Create a dedicated resource used in a REST step of a process
Notes:
- The dedicated resource called Merge Pull Request will enable to check if the pull request associated with a Service Manager ticket is merged when the ticket is closed.
- It is associated with a Microsoft Power Automate service.
- It is used in a Service Manager process using a REST action type.
CreateInServiceManagerRestResource_Procedure
Step 1: Manage rights for using the Service Manager REST API
1. Select Administration > Access Management > User Profiles in the menu.
2. Select a user profile authorized to use the Service Manager REST API.
3. Tick the REST API box.
Your changes will automatically be saved.
4. Repeat the procedure for all authorized profiles.
Step 2: Create a resource called Merge Pull Request associated with a Microsoft Power Automate service
See the detailed procedure.
Step 2.a: Create a service called Microsoft Power Automate
1. Select Administration > REST > Services in the menu.
2. Create a new service.
3. Specify the information below.
- Service Name: Enter the label 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 flow (step that will trigger the flow).
- 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}.
Step 2.b: Create a connection to the Microsoft Power Automate service.
1. Create a new connection.
2. Specify the information below.
- Connection Name: Enter the label GitHub.
- Authentication Method: None.
- Service Name: Select the Microsoft Power Automate service you created at step 2.a.
The URL of the service will automatically appear.
- subdomain: Copy and paste the prod-55.westeurope value of the URL you stored in your text editor.
Step 2.c: Create a resource associated with the Microsoft Power Automate service
1. Create a new resource.
2. Specify the information below.
- Label: Enter the label Merge Pull Request.
- Resource URI: ID of the new resource.
- Copy and paste the URL you stored in your text editor when creating the MS Power Automate flow (step that will trigger the flow).
- 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
- Contents: Body of the query containing the data to be updated. Copy and paste the text below without inserting any spaces or line breaks.
{"Description": "{Description}","id": "{id}","Host": "{sys.EVSM_HOST}","URL": "{sys.EVSM_REST_SERVICE_URL}","Account": "{sys.EVSM_ACCOUNT}","Title": "{Title}","Priorite": "{Priorite}"}
Step 3: Use the Merge Pull Request resource in a REST step of a process
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 Merge Pull Request resource from the REST Actions category of the palette of action types 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.
See the description
4. Click Confirm Changes.
Links to other integrations
- Microsoft Power Automate integration (formerly known as Microsoft Flow)
- Azure DevOps integration (via Microsoft Power Automate)
- Azure DevOps integration (via Microsoft Power Automate) - Create Bug and Task work items
- GitHub integration (via Microsoft Power Automate)
- GitHub integration (via Microsoft Power Automate) - Approve a review
- GitHub integration (via Microsoft Power Automate) - Merge a pull request
- GitHub integration (via Microsoft Power Automate) - Close a pull request
List of files to download
Note: To find out more, see the step-by-step integration process.
- Flow