GitHub
By integrating GitHub with DX, you can analyze pull requests, pull request reviews, repositories, and issues. Please refer to the API documentation below and our schema explorer to see what data DX imports—note that DX does not read or access your source code.
In addition to the GitHub connector, you can setup additional connectors for GitHub Actions, GitHub Security, GitHub Copilot, GitHub Commits, and GitHub Projects. Each GitHub-related connection in DX should utilize a separate GitHub App or API token to avoid rate limit issues.
Prerequisites
To connect GitHub to DX, you need:
- a GitHub user account that is an Organization owner or Enterprise owner
- if Copilot metrics are desired, an enabled Copilot metrics API access policy
- allowlist DX IP addresses if your GitHub instance is behind a firewall or has IP restrictions
Setup instructions
Follow the steps below to connect GitHub to DX.
Data connection
Step 1
-
If you are using GitHub Enterprise Cloud, browse to the URL below with ENTERPRISE_NAME replaced:
https://github.com/enterprises/ENTERPRISE_NAME/settings/apps/new?public=false&url=https://getdx.com&metadata=read&deployments=read&issues=read&pull_requests=read&members=read&request_oauth_on_install=false&setup_on_update=false&webhook_active=false
-
If you are using GitHub Enterprise Server or GitHub Team Edition, browse to the URL below with ORGANIZATION_NAME replaced:
https://github.com/organizations/ORGANIZATION_NAME/settings/apps/new?public=false&url=https://getdx.com&metadata=read&deployments=read&issues=read&pull_requests=read&members=read&organization_administration=read&request_oauth_on_install=false&setup_on_update=false&webhook_active=false
Step 2
This will pre-populate settings and permissions, but you’ll need to manually enter a name for your GitHub App. We recommend naming your app [COMPANYNAME] DX - GitHub to avoid naming collisions with other GitHub Apps.
To enable organization-level Copilot metrics, enable Read-only access to Administration under Organization permissions. For enterprise-level Copilot metrics, please instead enable the separate GitHub Copilot Metrics connector.
Otherwise, below are the read-only GitHub App permissions required by DX:
Scope | Permission Type | Description |
---|---|---|
Repository | Read-only | Access to Deployments |
Repository | Read-only | Access to Issues |
Repository | Read-only | Access to Metadata |
Repository | Read-only | Access to Pull requests |
Organization | Read-only | Access to Members |
Step 3
Scroll to the bottom of the page and click the “Create GitHub App” button.
Step 4
The GitHub App ID will be shown at the top of the subsequent screen. Copy this ID down so it can be entered into DX later.
Step 5
On the same screen, scroll down to the “Private keys” heading and click “Generate a private key” which will initiate a download of a PEM file. Copy the contents of this file to be entered into DX later.
Step 6
Click on the “Install App” link in the sidebar navigation and then click “Install” beside your GitHub organization.
- To get your initial data imported as quickly as possible, please select only your most important repositories initially, then come back and select more later.
- By default, public repositories are not imported. If you would like public repositories to be imported, please contact DX Support.
Step 7
- Navigate to the connections page in DX and select “+ Connection” in the top right.
- Enter the credentials you have generated in the previous steps—refer to the information below for errors and troubleshooting.
Updating permissions
To update your GitHub App permissions:
- Go to your organization’s Developer Settings and click on GitHub Apps.
- Click *Edit** for the GitHub App you are using for DX.
- Navigate to the Permissions & events tab to make changes.
- After making changes, scroll down to the bottom of the page and click Save changes.
- To apply the changes, go to the Install App tab, click on the gear icon for each organization listed, and then click and accept the Review request as shown in the images below.
Copilot metrics API
Your GitHub metrics API access policy for an organization can be managed from the following URL:
https://github.com/organizations/ORGANIZATION_NAME/settings/copilot/policies
From this screen, you can enable Copilot Metrics API access:
Webhooks
DX supports GitHub webhooks ingestion to sync pull request data in real-time. This is recommended in order to ensure real-time data accuracy in DX.
To enable webhook ingestion, follow the steps below:
- Go to Organization settings > Webhooks
- Click Add webhook
- For the Payload URL input field, enter https://yourinstance.getdx.net/webhooks/github but with your unique subdomain
- Enter your DX webhooks secret which can be found on the Connections admin page
- Select “Let me select individual events”
- Uncheck Pushes
- Check Pull requests and Pull request reviews
Here’s what your settings should look like:
API reference
The table below lists the specific API endpoints that are used by DX.
Endpoint | Documentation |
---|---|
/orgs/{org}/repos | Link |
/orgs/{org}/members | Link |
/orgs/{org}/teams | Link |
/orgs/{org}/team/{team_id}/members | Link |
/orgs/{org}/outside_collaborators | Link |
/repos/{owner}/{repo}/pulls | Link |
/repos/{owner}/{repo}/issues | Link |
/repos/{owner}/{repo}/deployments | Link |
/repos/{owner}/{repo}/pulls/comments | Link |
/repos/{owner}/{repo}/pulls/{pull_number}/reviews | Link |
/repos/{repo}/issues/{number}/events | Link |
/repos/{repo}/labels | Link |
/orgs/{org}/copilot/metrics | Link |
Errors
The table below lists potential error codes when adding a connection in DX.
Error | Description |
---|---|
invalid_credentials |
Your API credentials entered are not valid. |
invalid_permissions |
Your GitHub App installation does not have the permissions required by DX, or is not installed to any GitHub organizations. |
no_resources |
Your GitHub App installation cannot access any repositories. |
private_key_needed |
The key passed in is not an RSA private key. |