Upsource 2020.1 Help

GitHub webhooks

To get real-time updates from your GitHub repositories, you can set webhooks on the GitHub side. Upsource supports three kinds of webhooks:

  • A VCS webhook created in a specific GitHub repository to update commits in a corresponding Upsource project. See instruction.

  • A global VCS webhook created in a GitHub organization to update commits in all your GitHub-based projects. Once created, it will work with every GitHub repository connected to your Upsource instance. See instructions.

  • A pull request webhook created in a GitHub repository will update pull requests and comments in a corresponding Upsource project. A project must be synchronized to recognize this webhook. See instructions.

Set up a project-specific webhook to update commits

  1. Open your repository on GitHub.

  2. Navigate to Settings → Webhooks and click Add webhook.

  3. In the Payload URL field, enter:

    https://<upsource-base-url>/~vcs/<project-id>

    (For example: my-upsource-server.com/~vcs/my-project)

    You can find the project ID on the Edit page of your project in Upsource.

    Make sure the URL you provide can be accessed from the Internet.

  4. In the Content type field, select application/json.

  5. Leave the Secret field blank — no authorization is required.

  6. Choose Just the push event from the events that should trigger the webhook.

  7. Check Active and click Add webhook to create and enable it.

Set up an organization-wide webhook to update commits

  1. Navigate to the Settings page of your organization on GitHub.

  2. On the Settings page, navigate to Webhooks then click Add webhook.

  3. In the Payload URL field, enter:

    https://<upsource-base-url>/~github-vcs

    (For example: my-upsource-server.com/~github-vcs)

    Make sure the URL you provide can be accessed from the Internet.

  4. In the Content type field, select application/json.

  5. Leave the Secret field blank — no authorization is required.

  6. Choose Just the push event from the events that should trigger the webhook.

  7. Check Active and click Add webhook to create and enable it.

Set up a webhook to update pull requests

In a synchronized GitHub-based project, Upsource periodically polls the GitHub repository not only for new commits, but also for changes in pull requests and associated comments. To get updates without any delay, you can set up a webhook on the GitHub side, which will notify Upsource of any changes the moment they occur.

Upsource accepts POST requests generated by a GitHub webhook without authorization at https://<upsource-base-url>/~github-pull-request/<project-id>

In a received payload Upsource only recognizes the fields associated with pull requests and issues:

{ ... "issue": { ... "number": 123, ... }, ... }

{ ... "pull_request": { ... "number": 123, ... }, ... }

To set up a pull request webhook

  1. Open your repository on GitHub.

  2. Navigate to Settings → Webhooks and click Add webhook.

  3. In the Payload URL field, enter:

    https://<upsource-base-url>/~github-pull-request/<project-id>

    (For example: my-upsource-server.com/~github-pull-request/my-project)

    You can find the project ID on the Edit page of your project in Upsource.

    Make sure the URL you provide can be accessed from the Internet.

  4. In the Content type field, select application/json.

  5. Leave the Secret field blank — no authorization is required.

  6. Choose Let me select individual events and check all events related to pull requests, issues, and comments:

    • Issues
    • Issue comments
    • Pull requests
    • Pull request reviews
    • Pull request review comments
    github_webhook.png
  7. Check Active and click Add webhook to create and enable it.

Last modified: 02 April 2021