How to use IBM App Connect with GitHub

GitHub is an internet Git repository hosting service for software development and versioning. It offers distributed revision control and source code management (SCM) functionality of Git, access control, bug tracking, software feature requests, task management, continuous integration, and wikis for every project.

Availability:
  • App Connect Enterprise as a Service connector
  • A local connector in a Designer instance of IBM App Connect in containers (Continuous Delivery release)Local connector in containers (Continuous Delivery release) 12.0.7.0-r1 or later
  • A local connector in a Designer instance of IBM App Connect in containers (Support Cycle 2)Local connector in containers (Long Term Support Cycle-2 release)

Connecting to GitHub

Complete the connection fields that you see in the App Connect Designer Catalog page or flow editor. If necessary, work with your GitHub administrator to obtain these values.

To connect App Connect to a GitHub account, select your preferred application type:
  • GitHub Enterprise Server
  • GitHub Cloud
Then, select your preferred authorization type from the following table:
Application type Authorization type (for App Connect in containers) Authorization type (for App Connect Enterprise as a Service) Connection fields
GitHub Cloud Provide credentials for App Connect to use (BASIC) Provide credentials for App Connect to use (BASIC) Personal access token
GitHub Cloud Provide credentials for App Connect to use (BASIC OAUTH) Provide credentials for App Connect to use (BASIC OAUTH) Access token
GitHub Cloud   Use the application's website to sign in (OAUTH 2.0 AUTH CODE)  
GitHub Enterprise Server Provide credentials for App Connect to use (BASIC) Provide credentials for App Connect to use (BASIC) Endpoint URL and Personal access token
GitHub Enterprise Server Provide credentials for App Connect to use (BASIC OAUTH) Provide credentials for App Connect to use (BASIC OAUTH) Endpoint URL and Access token
Description of the connection fields:
Connection field Description
Endpoint URL The URL of the GitHub instance in the format https://<hostname>.
Tip: For more information, see Getting started with your GitHub account on the GitHub Docs page.
Personal access token The personal access token to access the GitHub API. Generate the personal access token from your GitHub account Settings page.
Tip: For more information about generating a Personal access token, see Creating a personal access token on the GitHub Docs page.
Access token The access token generated from the application client ID, tenant ID, client secret, scope, grant type, username, and password.
Tip: For more information about generating an access token, see Authorizing OAuth Apps on the GitHub Docs page.
To obtain the connection value for the personal access token, do the following steps:
  1. Log in to your GitHub Enterprise or Cloud account.
  2. Click your profile icon, and then select Settings.
  3. Go to Developer settings > Personal access tokens.
  4. Click Generate new token, then give a name for your access token.
  5. Select the scopes that you would like to grant this token. For more information, see Available scopes on the GitHub Docs page.
  6. If necessary, set an expiration date for your token from the Expiration drop-down menu.
  7. Click Generate token.
  8. Copy your access token and save it somewhere safe, as you won't be able to see it again.

To connect to a GitHub endpoint from the App Connect Designer Catalog page for the first time, expand GitHub, then click Connect. For more information, see Managing accounts.

Tip:

Before you use the account that is created in App Connect in a flow, rename the account to something meaningful that helps you to identify it. To rename the account on the Catalog page, select the account, open its options menu (⋮), then click Rename Account.

General considerations

Before you use App Connect Designer with GitHub, take note of the following considerations:

  • You require scopes such as repo and delete_repo for connecting to the GitHub connector. For more information about these scopes, see Scopes for OAuth Apps on the GitHub Docs page.
  • Except for the Organizations object, you need to select an organization from the drop-down list to perform any kind of operation.
    In the following example of using a Create issue action from the Issues object, the first option in the list corresponds to the login ID of the authenticated user, and the rest of the list corresponds to the organization IDs to which the user belongs:
    Example of a drop-down list containing organization IDs

    Here, if you select the login ID from the list, you can select your personal repositories to perform any create, retrieve, update, and delete operations or custom event operations.

  • For some objects (Reviews, Commit comments, Review comments, and Comments), if you use the ID filter for retrieving a single object, the mandatory drop-down list value that is selected will be ignored.
    In the following example, if you enter a value in the Review ID filter, then the Pull request value that is selected by you from the drop-down list will be ignored.
    Example of an object in which a pull request filter and review ID filter are applied

    Also, in this example, if you select any other filter values other than the Review ID or do not apply any filters, then all the reviews from the selected Pull request value are shown.

  • (General consideration) You can see lists of the trigger events and actions that are available on the Catalog page of the App Connect Designer.

    For some applications, the events and actions in the catalog depend on the environment and whether the connector supports configurable events and dynamic discovery of actions. If the application supports configurable events, you see a Show more configurable events link under the events list. If the application supports dynamic discovery of actions, you see a Show more link under the actions list.

  • (General consideration) If you are using multiple accounts for an application, the set of fields that is displayed when you select an action for that application can vary for different accounts. In the flow editor, some applications always provide a curated set of static fields for an action. Other applications use dynamic discovery to retrieve the set of fields that are configured on the instance that you are connected to. For example, if you have two accounts for two instances of an application, the first account might use settings that are ready for immediate use. However, the second account might be configured with extra custom fields.

Events and actions

GitHub events

These events are for changes in this application that trigger a flow to start completing the actions in the flow.

Show more configurable events: Events that are shown by default are pre-configured by using optimized connectivity. More items are available after you configure events that can trigger a flow by polling this application for new or updated objects. For more information about configurable events, see Configuring polled events to trigger flows.

GitHub actions

Your flow completes these actions on this application.

Branches
Retrieve branches
Merge branch
Issues
Create issue
Retrieve issues
Update issue
Add assignees
Remove assignees
Organizations
Retrieve organizations
Update organization
Pull requests
Create pull request
Retrieve pull requests
Update pull request
Merge pull request
Repositories
Create repository
Retrieve repositories
Update repository
Delete repository

More items are available when you have connected App Connect to GitHub.

Examples

Dashboard tile for a template that uses GitHub
Dashboard tile for a template that uses Github
Dashboard tile for a template that uses GitHub

Use templates to quickly create flows for GitHub

Learn how to use App Connect templates to quickly create flows that perform actions on GitHub. For example, open the Templates gallery, and then search for GitHub.

Dashboard tile for a template that uses GitHub
GitHub flow in detailed view

Use IBM App Connect to build flows that integrate with GitHub.

Read the blog in the IBM Community to learn how to create a repository or issue in GitHub when a new issue is created in Jira. Click Read the blog to go to the blog.