Configuring a GitHub Repository web trigger in an automation

Configure GitHub Repository web trigger to trigger an action whenever an event occurs in a repository. This example shows how to create a Task Bot with GitHub Repository web trigger to display the pull request body in a message box.

When the user specified in the settings creates a pull request in this repository, the trigger starts the configured Message box action.

Prerequisites

Ensure that you meet the following requirements:
  • License and permissions mentioned in GitHub web triggers.
  • An active GitHub personal access token stored as a credential in your Credential Vault.
  • A record variable named TriggerData.

Procedure

  1. Perform the following steps to create a Task Bot
    1. On the left pane, click Automation.
    2. Click Create > Task Bot.
      The Create Task Bot wizard appears.
    3. Enter an appropriate name for the bot in the Name field.
      All the bots are stored in \Bots folder by default.
    4. Optional: Add a description for the bot in the Description field.
    5. Optional: Click Choose and follow the prompts to save the bot in a different folder.
    6. Click Create & Edit.
      The bot is created and the Edit Task Bot page appears.
  2. Perform the following steps to add and configure the GitHub Repository web trigger.
    1. Click Triggers > GitHub, and then double-click Repository web trigger to add the web trigger.
    2. Select Pull request from the Listen to event drop-down.
    3. Enter the repository name in the Repository name field.
      The trigger monitors this repository for the event.
    4. Enter the GitHub profile name in the User profile field.
      The trigger activates the subsequent action only if the user with the profile name specified in this field creates or reopens a pull request.
    5. Select Personal Access Token > Credential, and click Choose.
    6. Follow the prompts in Pick a credential modal and choose the Personal Access Token stored in the Credential Vault.
    7. Select TriggerData in Response dropdown.
      This record variable captures the trigger response data about the event in which the change occurred in a key-value pair format.
  3. Perform the following steps to add and configure the Message Box action.
    1. Click Actions > Message Box, and then double-click or drag Message Box to add the action.
    2. Enter an appropriate title for the message box in Enter the message box window title.
    3. Enter $TriggerData{pull_request.body}$ in Enter the message to display.
      The $TriggerData{pull_request.body}$ key from the trigger response data contains the body of the pull request as the corresponding value.
  4. Click Save to save the configuration.
When you click Run > Run with triggers, the system activates the trigger, and the trigger starts listening for Pull request events in the specified GitHub repository. When the user with the specified profile name creates or reopens a pull request in this repository, the trigger starts the Message Box action. The message box displays the pull request body.