# OpenAI, GitHub, and Confluence recipe
This use case guides you through connecting OpenAI, GitHub, and Confluence to create a powerful automation.
# What does this recipe do?
This recipe retrieves merged pull requests (PRs) weekly from GitHub, iterates through each one to check for a specific Jira project key in the PR body, and, if found, sends the PR body to ChatGPT for a summary of the changes. Each summarized PR is then added to a new release notes page in Confluence.
# Create your recipe
Complete the following steps to create a recipe that creates release notes in Confluence based on merged pull requests in GitHub:
USE CASES ARE INTENDED AS EXAMPLES ONLY
This use case is intended to serve as an example. Recipe modifications such as trigger and action configuration and conditional logic may require adjustments if you plan to include this recipe in your own workflow.
Sign in to your Workato account and go to the workspace project where you plan to add the recipe.
Set up connections for OpenAI, GitHub, and Confluence using the steps in the following sections:
Set up your OpenAI connection.
Click Create > Connection.
Search for and select OpenAI
as your connection in the New connection page.
Provide a name for your connection in the Connection name field.
OpenAI connection setup
Use the Location drop-down menu to select the project where you plan to store the connection.
Enter your API key in the API key field. You can obtain this value from the OpenAI API keys page (opens new window).
Click Connect.
Set up your GitHub connection.
Click Create > Connection.
Search for and select GitHub
as your connection in the New connection page.
Provide a name for your connection in the Connection name field.
GitHub connection setup
Use the Location drop-down menu to select the project where you plan to store the connection.
Use the Connection type drop-down menu to select the connection method you plan to use. You can select your on-premise group name or select Cloud to use a direct connection.
Use the Authentication type drop-down menu to select the authentication method. Available options include OAuth App, GitHub App, or Personal Access Token.
If you selected GitHub App:
Provide your app ID in the GitHub App ID field.
Enter the private key in the GitHub App Private key field.
Fill in the Installation ID field.
Optional. Expand Advanced configuration to provide the API Root URL, which is applicable when using GitHub Enterprise Server.
If you selected Personal Access Token:
Enter your personal access token in the Personal Access Token field.
Click Connect.
Set up your Confluence connection.
Click Create > Connection.
Search for and select Confluence
as your connection in the New connection page.
Provide a name for your connection in the Connection name field.
Confluence connection setup
Use the Location drop-down menu to select the project where you plan to store the connection.
Use the Connection type drop-down menu to select the connection method you plan to use. You can select your on-premise group name or select Cloud to use a direct connection.
Use the Auth type drop-down menu to select your authentication method. Options include Basic, API token, and OAuth 2.0.
Provide your connection information.
- If using a cloud connection: Enter your Confluence subdomain in the Confluence subdomain field. For example, if your URL is
https://acme.atlassian.net
, your subdomain isacme
. - If using an on-prem connection: Enter the root URI (includes protocol, optional port, and hostname) of your Confluence host in the Confluence root URI field.
Provide your authentication information.
If you selected Basic authentication:
Enter your username (not email) in the Username field.
Enter your password in the Password field.
If you selected API token:
Enter your email in the Email field.
Enter your API token in the API token field. You can create an API token by going to your Atlassian account and selecting Security (opens new window) > API tokens > Create API token.
If you selected OAuth 2.0:
Enter your client ID in the Client ID field.
Enter your client secret in the Client secret field.
Optional. Expand Advanced settings to select scopes to request for this connection. The following scopes are selected by default:
read:confluence-groups
read:confluence-content.summary
write:confluence-content
search:confluence
Click Connect.
Click Create > Recipe.
Provide a name for your recipe in the Name field and select the project in which you plan to store the recipe from the Location drop-down menu.
Select Run on a schedule as your starting point and click Start building. This creates a new recipe with the Scheduler by Workato New recurring event trigger. This trigger doesn't require a connection.
Set up your recipe
Set up your Scheduler by Workato New recurring event trigger.
Click the trigger in the recipe editor.
Click the trigger
Use the Time unit drop-down menu to select Weeks.
- Available options include Minutes, Hours, Days, Weeks, Months, or Custom schedule.
Enter 1
in the Trigger every field to run the recipe weekly.
Choose the days the recipe should run in the Days of the week field. For example, select Monday.
Specify the time for the recipe to run in the Trigger at field. For example, enter 12:00 AM
.
Optional. Select the timezone in the Timezone field. If left blank, the default is America/Los_Angeles.
Optional. Set the start date and time in the Start after field, or leave it blank to activate the trigger immediately after you start the recipe. You can't change this value after you run or test the recipe.
Configure the trigger
Click Save.
Step summary
This trigger sets the interval for how frequently the recipe runs. The Scheduler by Workato trigger doesn't require connection setup.
Click the +
Add step button and select Action in app.
Click Add step > Add action in app
Set up your GitHub Search issues/pull requests (batch) action.
Search for and select GitHub
in the Choose an app search box.
Choose GitHub
Select Search issues/pull requests as your action.
Select the Search issues/pull requests action
Select the GitHub connection you created in the preceding steps.
Use the Organization drop-down menu to select the organization containing the repository you plan to access.
Use the Repository name drop-down menu to select your repository.
Use the Type drop-down menu to select PR.
Use the Status drop-down menu to select Merged.
Switch the Closed after field to formula mode.
Map the Scheduler by Workato Scheduled time | Step 1
datapill to the Closed after field.
Append - 7.days
in the Closed after field.
Fill out the Closed after field
This formula filters the search to retrieve only pull requests merged since the previous week.
Click Save.
Step summary
This step searches for pull requests in your selected GitHub repository that were merged since the previous week.
Click the +
Add step button and select Action in app.
Set up your Variables by Workato Create variable action.
Search for and select Variables by Workato
in the Choose an app search box.
Choose Variables by Workato
Select Create variable as your action.
Select the Create variable action
Click Add a variable.
Enter Content
in the Label field.
Click Add variable.
Switch the Content field to formula mode and enter ""
to initialize the variable with an empty string.
Fill out the Content field
This initialization is necessary for a later step, as you can't append a string (the content generated from ChatGPT) to a nil
variable.
Click Save.
Step summary
This step creates an empty variable named Content
.
Click the +
Add step button and select Repeat for each.
Click Add step > Repeat for each
How does the Repeat for each condition work?
A Repeat for each loop repeats one or more actions for each item in a list. The loop ends automatically when the entire list is processed.
Set up your Repeat for each loop.
Map the GitHub Issues | Step 2
list datapill to the Input list field. This datapill contains a list of pull requests that match the search criteria specified in step 2.
Use the Repeat mode drop-down menu to select One item at a time.
Ensure No is selected in the Clear step output drop-down menu.
Configure the Repeat for each loop
Click Save.
Step summary
This step iterates through each of the pull requests that were merged in the past week.
Click the …
(ellipsis) next to the placeholder step in the recipe editor and select Delete.
Delete the placeholder step
Click the +
Add step button and select IF condition. Ensure this step is nested within the Repeat for each loop.
Click Add step > IF condition
How do IF conditions work?
An IF condition enables you to make decisions based on specific conditions. You can control your recipe workflow by executing different actions depending on whether a condition you specify is true or false.
Set up your IF condition.
Map the Foreach Body | Step 4
datapill to Data field. Alternatively, you can use the Title | Step 4
datapill.
Use the Condition drop-down menu to select contains.
Enter the relevant Jira project key in the Value field. For example, to only include merged PRs with the Jira project key CT
in release notes, enter CT-
in this field.
Configure the IF condition
Click Save.
Step summary
This step verifies if the GitHub pull request includes a specific Jira project key in its title or body, ensuring that only relevant pull requests linked to the designated Jira project are included in the release notes.
Click Select an app and action.
Set up your OpenAI Send messages to OpenAI models action.
Search for and select OpenAI
in the Choose an app search box.
Choose OpenAI
Select Send messages to OpenAI models as your action.
Select the Send messages to OpenAI models action
Select the OpenAI connection you created in the preceding steps.
Use the Message type drop-down menu to select Single message.
Enter the following prompt in the Text to send field:
Generate a clear, user-friendly description of the update using the details provided in the pull request description. Format each change as a standalone release note item without additional headings or introductory text. Keep it concise and use plain language.
Description:
Append the Foreach Body | Step 4
datapill to the end of the message in the Text to send field.
Map the Body datapill
Optional. Use the Model drop-down menu to select the GPT model to use. For example, select gpt-4o-mini. Defaults to gpt-3.5-turbo if left blank.
Click Save.
Step summary
This step sends a message to ChatGPT and asks it to generate a description of the merged pull request based on the PR body.
Click the +
Add step button and select Action in app. Ensure this step is nested within the IF condition.
Set up your Variables by Workato Update variables action.
Search for and select Variables by Workato
in the Choose an app search box.
Choose Variables by Workato
Select Update variables as your action.
Select the Update variables action
Use the Variable name drop-down menu to select Content (step 3).
Switch the Content field to formula mode and perform the following actions:
Map the Variables by Workato Content | Step 3
datapill.
Enter + "\n" + "<a href='" +
to place the link on a new line.
Map the Foreach Html URL | Step 4
datapill.
Enter + "'>" +
.
Map the Foreach Title | Step 4
datapill.
Enter + "</a>" + "\n" +
to add the closing link tag and begin a new line.
Map the OpenAI Best choice | Step 6
datapill.
Enter + "\n"
to create a new line for details about the next merged PR.
Update the Content variable
Click Save.
Step summary
This step appends the ChatGPT response to the Content
variable. The step links each merged PR title to the corresponding GitHub pull request and adds bullet points that summarize the changes described in the PR body.
Click the +
Add step button and select Action in app. Ensure this step is placed outside of the IF condition and Repeat for each loop.
Set up your Confluence Create page action.
Search for and select Confluence
in the Choose an app search box.
Choose Confluence
Select Create page as your action.
Select the Create page action
Select the Confluence connection you created in the preceding steps.
Enter the space key in the Space key field. This tells Confluence in which space the page should be created.
Switch the Title field to formula mode and enter the following:
"Release Notes for: " + today.to_s
This formula creates the title for the Confluence page in the following format: Release Notes for: YYYY-MM-DD
.
Map the Variables by Workato Content | Step 3
datapill to the Body field.
Example configuration of the Create page action
Click Save.
Step summary
This step creates the Confluence page with the release notes.
Your OpenAI, GitHub, and Confluence recipe is ready to test and implement.
Example recipe configuration.
OpenAI, GitHub, and Confluence recipe
Last updated: 11/7/2024, 4:54:15 PM