GitHub Integration

Applies to Collaborator 14.5, last modified on April 09, 2024

About

  • Collaborator integrates with Git repositories hosted at GitHub.com, as well as on GitHub Enterprise servers in your network.

  • When you integrate Collaborator with a GitHub repository, your Collaborator server creates reviews automatically for pull requests in the repo, as well as for push events that occur in that repo. For complete information on how the integration works, see Integration With Repository Hosting Services.

  • To inform Collaborator about changes, GitHub uses a webhook that sends notification messages to your Collaborator server.

  • To set up the webhook and other integration parameters, you need to set up some options in Collaborator and in GitHub. See the rest of this topic for details.

Supported Hosting Services

  • GitHub (github.com)

  • GitHub Enterprise

LFS is NOT supported for remote systems (supported for native Git only).

Requirements

  • Your Collaborator server must be accessible to GitHub and vice versa. You may need to configure your firewall or enable tunneled connections to expose the server’s External URL to the Web. If needed, ask your system administrator for help.

  • Note that Collaborator makes API calls to https://api.github.com which is a machine separate from https://github.com. When using trusted connections, ensure that the security certificates from both machines are accepted.

  • To configure integration settings in Collaborator, you need Administrator privileges.

1. Get GitHub Tokens

To integrate with GitHub, you need a personal access token that will be used to access your repositories.

For detailed information on generating a personal access token, follow instructions on this page of GitHub documentation:

https://help.github.com/articles/creating-an-access-token-for-command-line-use/

Notes:

  • When setting up the token parameters, make sure to enable the following scopes for the token:

    • repo
    • admin:org
    • admin:repo_hook, and
    • admin:org_hook
  • After GitHub generated the token, save it somewhere or write it down. We will need the token later, when we will configure the integration between Collaborator and GitHub.

2. Set Up Integration

Collaborator offers two groups of settings for configuring integration with remote repositories:

Settings When to use
Easy Add Repository tab We recommend using these settings to set up new connections to your repositories quickly.
Configure Remote Systems tab Use these settings to configure existing connections. Though you can use these settings to set up integration, the settings on the “Easy Add Repository” tab will help you do this faster.

Additionally, you can create auto-polling configuration to periodically look for new repositories on the specified server and suggest creating integrations for them.

Easy Add Repository tab (recommended)

  1. Log in to Collaborator as administrator. (To integrate with GitHub repositories, you need administrator privileges in Collaborator).

  2. On the Collaborator main toolbar, click ADMIN, and then select Repository Hosting Services from the tree on the left. Then switch to the Easy Add Repository tab.

  3. On the tab, select GitHub in the Add repository for box and click Next:

    Integration with GitHub: Start

    Click the image to enlarge it.

  4. Collaborator will display a page with connection details.

    Integration with GitHub: Settings

    Click the image to enlarge it.

    Specify settings in the the following sections of the wizard:

    Connection settings
    Setting Description

    GitHub Enterprise host name

    Required for repositories hosted on GitHub Enterprise servers. Specifies the host name of your GitHub Enterprise server.

    Organization

    Required only for organization owned repositories (https://github.com/OrganizationName/RepoName). Specifies the name of your GitHub organization account (OrganizationName).

    Scopes for user

    Optional. Defines which types of repositories to track.

    • Owner: Repositories that are owned by the specified user. (Default)
    • Collaborator: Repositories that the user has been added to as a collaborator.
    • Organization member: Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on.

    Webhooks will be created for those repositories where allowed by the repository permissions for the specified user.

    Personal access token

    Required. The personal access token for a GitHub account that has access to your remote repository.

    This is the token that we generated in GitHub earlier.

    Webhook secret token

    Optional. The secret token for webhook events. If provided, must be at least 8 characters long.

    To learn more about webhook settings on the GitHub side, see GitHub documentation:

    https://developer.github.com/webhooks/

    After specifying connection settings, you can click Load repositories to retrieve a list of repositories available for the specified user or organization.

    Select repositories

    Select repositories

    Optional. Displays a list of repositories available for the specified user or organization.

    Select which repositories you need to track. Use Ctrl+click or Shift+click for multi-selection.

    If any of the repositories were chosen, the wizard will display the Create for selected button below the settings section.

    If none of the repositories were chosen, the wizard will display the Create for all button below the settings section.

    Override existing configurations

    Optional. Specifies whether to override existing configurations that track the same repository URI.

    Branches

    Branches to track

    Optional. The names of branches to track changes and create reviews on pull requests and direct pushes. Separate multiple branch names with commas.

    You can use Java-style regular expressions to match specific branch names, or you can use the * wildcard (alone, or separated by commas) to match all branches. Note that wildcards and regular expressions cannot be used if you enable the Status check required setting (see below).

    If this edit box is empty, the branch main will be tracked.

    Ignore pushes for branches

    Optional. Specifies branches for which Collaborator will not create reviews on direct pushes.

    You can enter one or several branch names. Separate multiple branch names with commas. You can also use Java-style regular expressions to match specific branch names, or you can use the * wildcard (alone, or separated by commas) to match all branches.

    Status check required

    Specifies if Collaborator should enforce status checks for the tracked branches before merging pull requests.

    If this option is enabled, you cannot use regular expressions in the Branches to track setting, since this option requires exact name match.

    Pull request actions

    Create review automatically

    If enabled, reviews for pull request are created automatically.

    If disabled, user can add pull request to a review manually through Remote System links, by API call or by special command directly from pull request.

    When review completed

    Optional. Specifies an action to perform when a review corresponding to the pull request was accomplished:

    • Do nothing: Do not perform any action.
    • Merge pull request: Merge pull request that corresponds to a review.
    • Merge pull request and delete its branch: Merge pull request that corresponds to a review and then delete the respective branch.
    • Squash and merge pull request: Squash and merge pull request that corresponds to a review.
    • Squash and merge pull request and delete its branch: Squash and merge pull request that corresponds to a review and then delete the respective branch.
    • Rebase and merge pull request: Rebase and merge pull request that corresponds to a review.
    • Rebase and merge pull request and delete its branch: Rebase and merge pull request that corresponds to a review and then delete the respective branch.

    To learn more about pull request merge strategies, see GitHub documentation.

    Allow users to select merge strategy in review

    If enabled, regular users would be able to choose pull request merge strategies in each separate review.

    If disabled, all pull requests would behave as specified by the When review completed setting.

    Wait for signature (if enabled) before merge

    Optional. Effective, if any of merge actions (merge, squash and merge, rebase and merge) was selected in When review completed setting.

    If enabled Collaborator will wait for the completed review to be signed off before merging the respective pull request. Otherwise, pull request will be merged immediately, even if the review have not been signed yet.

    Allow to complete review with conflicts in pull request

    Should it be possible to complete a review if there are conflicts in the respective pull request.

    When review cancelled/deleted/rejected

    Optional. Specifies an action to perform when a review corresponding to a pull request was cancelled, deleted or rejected:

    • Do nothing: Do not perform any action.
    • Close pull request: Close pull request that corresponds to a review.
    • Close pull request and delete its branch: Close pull request that corresponds to a review and then delete the respective branch.

    Auto assign reviewers

    Whether to assign Collaborator reviewers when some specific users or teams were added as pull request reviewers or specified as code owners on the GitHub side and integration can match those GitHub users with Collaborator users.

    Reopen a review when

    Optional. Specifies in what cases Collaborator should reopen completed reviews. May include any combination of the following:

    • when a push to a pull request is made,
    • when a comment is added to a pull request,
    • when a comment is added to commit which is a part of a pull request
    Review settings

    Default review template

    Optional. Specifies the initial template that will be chosen when creating review (if set to "None", the first template in the list will be chosen).

    The value of this setting overrides the value of Default review template setting specified on group level.

  5. Click the Create for selected button or the Create for all button to create repository integrations and create automatically webhooks for each repository in GitHub. To stop suggesting integrations for some specific repositories, select these repositories in the list and click Ignore selected.

    For every repository a separate configuration will be created in Collaborator and a webhook will be automatically added in GitHub.

Configure Remote Systems tab

  1. Log in to Collaborator as an administrator. (To configure integration settings, you need administrator privileges in Collaborator).

  2. On the Collaborator main toolbar, click ADMIN, and then select Repository Hosting Services from the tree on the left. Then switch to the Configure Remote Systems tab.

  3. In the New Remote System Configuration section, select GitHub and click Create:

    Integration with GitHub: Start

    Click the image to enlarge it.

  4. Collaborator will display a page with configuration settings. Specify settings in the following sections:

    GitHub settings
    Setting Description

    Title

    Required. The configuration name as it will be displayed in Collaborator user interface.

    GitHub repo URI

    Required. The URI of the GitHub repository to be tracked, for example, https://github.com/torvalds/linux.git.

    You can copy the URI from the repository page in GitHub:

    Getting URI of a GitHub repository

    GitHub API token

    Required. The personal access token for the GitHub account that has access to remote repository.

    This is the token that we generated in GitHub earlier.

    Webhooks secret token

    Optional. The secret token for webhook events. If provided, must be at least 8 characters long.

    To learn more about webhook settings on the GitHub side, see GitHub documentation:

    https://developer.github.com/webhooks/

    Webhook status

    Indicates the current status of the webhook:

    • Webhook is absent: The webhook has not been created yet.
    • Webhook isn't active: The webhook has been created, but is inactive.
    • Up and running: The webhook is active.

    To create or activate a webhook, click Update webhook.

    Important: Click this button, when you set up integration with your repository for the first time.

    Branches

    Branches to track

    Optional. The names of branches to track changes and create reviews on pull requests and direct pushes. Separate multiple branch names with commas.

    You can use Java-style regular expressions to match specific branch names, or you can use the * wildcard (alone, or separated by commas) to match all branches. Note that wildcards and regular expressions cannot be used if you enable the Status check required setting (see below).

    If this edit box is empty, the branch main will be tracked.

    Ignore pushes for branches

    Optional. Specifies branches for which Collaborator will not create reviews on direct pushes.

    You can enter one or several branch names. Separate multiple branch names with commas. You can also use Java-style regular expressions to match specific branch names, or you can use the * wildcard (alone, or separated by commas) to match all branches.

    Status check required

    Specifies if Collaborator should enforce status checks for the tracked branches before merging pull requests.

    If this option is enabled, you cannot use regular expressions in the Branches to track setting, since this option requires exact name match.

    Pull request actions

    Create review automatically

    If enabled, reviews for pull request are created automatically.

    If disabled, user can add pull request to a review manually through Remote System links, by API call or by special command directly from pull request.

    When review completed

    Optional. Specifies an action to perform when a review corresponding to the pull request was accomplished:

    • Do nothing: Do not perform any action.
    • Merge pull request: Merge pull request that corresponds to a review.
    • Merge pull request and delete its branch: Merge pull request that corresponds to a review and then delete the respective branch.
    • Squash and merge pull request: Squash and merge pull request that corresponds to a review.
    • Squash and merge pull request and delete its branch: Squash and merge pull request that corresponds to a review and then delete the respective branch.
    • Rebase and merge pull request: Rebase and merge pull request that corresponds to a review.
    • Rebase and merge pull request and delete its branch: Rebase and merge pull request that corresponds to a review and then delete the respective branch.

    To learn more about pull request merge strategies, see GitHub documentation.

    Allow users to select merge strategy in review

    If enabled, regular users would be able to choose pull request merge strategies in each separate review.

    If disabled, all pull requests would behave as specified by the When review completed setting.

    Wait for signature (if enabled) before merge

    Optional. Effective, if any of merge actions (merge, squash and merge, rebase and merge) was selected in When review completed setting.

    If enabled Collaborator will wait for the completed review to be signed off before merging the respective pull request. Otherwise, pull request will be merged immediately, even if the review have not been signed yet.

    Allow to complete review with conflicts in pull request

    Should it be possible to complete a review if there are conflicts in the respective pull request.

    When review cancelled/deleted/rejected

    Optional. Specifies an action to perform when a review corresponding to a pull request was cancelled, deleted or rejected:

    • Do nothing: Do not perform any action.
    • Close pull request: Close pull request that corresponds to a review.
    • Close pull request and delete its branch: Close pull request that corresponds to a review and then delete the respective branch.

    Auto assign reviewers

    Whether to assign Collaborator reviewers when some specific users or teams were added as pull request reviewers or specified as code owners on the GitHub side and integration can match those GitHub users with Collaborator users.

    Reopen a review when

    Optional. Specifies in what cases Collaborator should reopen completed reviews. May include any combination of the following:

    • when a push to a pull request is made,
    • when a comment is added to a pull request,
    • when a comment is added to commit which is a part of a pull request
    Review settings

    Default review template

    Optional. Specifies the initial template that will be chosen when creating review (if set to "None", the first template in the list will be chosen).

    The value of this setting overrides the value of Default review template setting specified on group level.

  5. Click Test Connection to verify if you entered data correctly.

    Click Save to store the settings.

    Click on Update Webhook button to add webhook for the repository on the remote system's side.

Creating GitHub auto-polling configuration

Sections above describe how to add integrations for existing repositories. When some new repositories are created on a server, you may integrate them manually. Alternatively, you can setup GitHub auto-polling configuration that will periodically look for new repositories on the specified server, organization, team or user and suggest creating integrations for them.

  1. Log in to Collaborator as administrator. (To integrate with GitHub repositories, you need administrator privileges in Collaborator).

  2. On the Collaborator main toolbar, click ADMIN, and then select Repository Hosting Services from the tree on the left. Then switch to the Repository Auto-Polling tab.

  3. On the tab, select GitHub in the Add configuration box and click Next.

  4. Collaborator will displays a page with connection details.

    Integration with GitHub: Auto-polling Settings

    Click the image to enlarge it.

    Fill in the edit boxes:

    Setting Description
    Server URI Required. The URI of GitHub server, user, organization or team to be polled for new repositories.

    Token

    Required. The personal access token of the GitHub account.

    This is the token that we generated in GitHub earlier.

    Scopes for user

    Optional. Defines which types of repositories to fetch

    Scope Description
    Owner (default) Repositories that are owned by the specified user
    Collaborator Repositories that the user has been added to as a collaborator.
    Webhooks will be created for those repositories where allowed by the repository permissions for the specified user.
    Organization member Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on.
    Webhooks will be created for those repositories where allowed by the repository permissions for the specified user.

    After specifying these values, you can click Test connection to verify if you entered data correctly.

  5. After you specified the values, click Save. This will create an auto-polling configuration and display it in the Auto-Polling Configurations List.
  6. Scroll down the Repository Auto-Polling tab and check that the Enable Auto-Polling setting is on and optionally change the Auto-Polling Interval setting.

Now Collaborator will automatically check if any new repositories were found on the specified server. Once found, it will notify administrators and suggest creating integrations with these newly created repositories via the Easy Add Repository wizard.

Enable/Disable configuration

Once a new repository configuration is created, it is enabled automatically. However, you can enable and disable integration with GitHub manually. To do this:

  1. In Collaborator, go to ADMIN > Integrations.
  2. In the Integration Status section find the Enable GitHub Integration setting and change it to Yes or No, respectively.
Enable GitHub Integration

Click the image to enlarge it.

Known Issues and Specifics

  • If repository contains a CODEOWNERS file that defines users responsible for certain files in a repository and integration can match those GitHub users with Collaborator users, and the Auto assign reviewers option is on, then it will automatically add those users as reviewers on Collaborator's side.

  • You can specify GitHub users as reviewers when you are creating a pull request. If your teammates link their GitHub accounts with their Collaborator accounts correctly, and the Auto assign reviewers option is on, then Collaborator will automatically add those users as reviewers to the created review on the Collaborator side.

  • Similarly, you can specify some team as reviewer when creating pull request on the GitHub side, or specify team in CODEOWNERS file. In this case, integration tries to match members of that team with Collaborator users, and if the Auto assign reviewers option is on, it will automatically add those users as reviewers on Collaborator side.

  • If your GitHub repositories use continuous integration, the Remote System Links section will also display current build statuses of your CI systems (Jenkins, Travis and so forth).

  • You can secure webhook calls by providing a secret token when you are creating or modifying a webhook and integration settings in GitHub and in Collaborator. This token will be used as server signature for verifying webhook events. The webhook token is optional and is absent by default.

  • Collaborator will not create reviews on merge commits of pull requests when their merge commit message starts with the Merge pull request # substring or when merge commit message was specified in the Pull Request Merge Info section.

  • If the remote repository server is not accessible, Collaborator will retry connecting after a certain time period and will perform several retry attempts. Wait time is increased with each attempt: wait_time*1, wait_time*2, wait_time*3 and so on. Default wait time is 1 second and Collaborator will perform 3 retries. Wait time and maximal number of attempts could be configured via Java VM Options. If the server did not respond after all attempts, Collaborator will mark the respective webhook as inactive and put an exception to the remoteSystem.log

  • Right after you set up integration with some GitHub repo, the very first push or pull request to this repo will not be tracked. Subsequent requests will be tracked as they should.

See Also

Source Control Integrations

About GitHub Integration
 
Highlight search results