The underlying use case of the Export Github Issues to Google Spreadsheet scenario is that you get details of newly created Github issues from a list of Git repositories in Github and add those details to a Google Spreadsheet. This section explains how to modify this default scenario as follows:
- Change the information about issues that you retrieve from Github.
- Change the default time duration of the scheduled task that checks whether new Git issues are created.
- Retrieve the issues that were created after a time stamp that you mention. You can set any time stamp in the past to see information for those old issues.
Let's get started.
Download and install WSO2 EI tooling.
Download the contents in this Github location to a suitable location in your machine.
Open the EI tooling interface. The workspace is any folder in your local file system where your tooling artifacts will be saved. For example,
- Once the workspace opens, click the File -> Import menu from the menu bar and then under the General drop-down, click Existing Projects into Workspace.
- Select the source folder that you downloaded earlier in step 2 as the root directory, select all the projects inside the directory, and click Finish.
Let's import the required connectors to the project.
- Right click
GithubToSpreadsheetand click Add or Remove Connector.
- Select Add connector and click Next.
Connect to the WSO2 Store using the Connector store location option and select the following connectors from the list once the available connectors load.
You have now created a tooling project using the downloaded artifacts. Next, let's modify the artifacts to our requirements.
Modify the project's artifacts
GithubToSpreadsheetin the left navigation and note that the project's artifacts open in the tooling interface as follows:
Open the sequence
githubToSpreadsheet.xmlunder src -> man -> synapse-config -> sequences:
Tip: See Working with sequences for information about sequences.
To get more information about the Github issues, go to the Source tab of the above sequence and modify the below code as you want. For example, if you want to get the issue No, edit the property mediator as follows:
To change the time duration of the scheduled task, open
getGitIssuesToSpreadsheet.xmlthat is under src -> man -> synapse-config -> tasks and change the value of the Interval property.
Tip: If you change the task interval here, be sure to change the
task_interval_timeproperty with the same value in the environment variables also.
Tip: For more information on scheduled tasks, see creating a scheduled task.
To get all the issues that are created after a timestamp that you specify, create a mysql database to store the timestamp.
There is a scheduled task that polls the Github repository and collects the issues that are created after a timestamp value that is in the database. After each poll, the sceduled task updates the timestamp value to the current time so that the next time it polls, it will retreive only the newer issues from Github. However, you might sometimes want to see all issues that are created after a specific time in the past.Click here for information on how to create a database to store the timestamp...
You can create a database and store the timestamp value in it. The timestamp is in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
- Log in to WSO2 Integration Cloud by going to http://wso2.com/cloud/, clicking the Sign In link and then selecting WSO2 Integration Cloud.
- The Integration Cloud opens. Click CREATE DATABASE.
- Enter the following information in the form that opens, scroll down, and click Create Database.
- Database Name: githubToSpreadsheetRegistry
- Default User Name: root
Give a suitable password
The database that you just created opens on the console. Copy the database name, URL, and username.
You see additional characters in the database name and username because the Integration Cloud adds them to uniquely identify the tenant of the database and the user.
Assuming you already have MySQL Server installed in your local environment, go to the command-line or terminal, type
enterto go to the MySQL prompt, and then execute the following commands to connect to the MySQL database that you just created.
The following commands are an example. You can change the database name, table name, column name and Timestamp value as you want.
Back in the Tooling interface, open the sequence
githubToSpreadsheet.xmlthat is under src -> man -> synapse-config -> sequences and replace its code with this code.
Modify the following code blocks in your code with your mysql credentials, database URL, driver, table name, and column name.
- Once you are done modifying the default scenario, right click GithubToSpreadsheetCAPP and click Export Composite Application Project. You will then be promped to save the project's artifacts as a CAR file.
You have now modified the default scenario.