Connecting GitHub
editConnecting GitHub
editConnector configuration instructions provided in this guide apply both to GitHub and GitHub Enterprise Server.
GitHub is a development platform, version control and collaboration platform for teams of all sizes. From open source to business, you can host and review code, manage projects, and build software across departments and continents. The GitHub connectors provided with Workplace Search automatically capture, sync and index the following items:
Issues |
Including ID, Content, Status, Repository, Created By, Comments, Comment authors and timestamps |
Pull Requests |
Including ID, Content, Status, Repository, Created By, Comments, Comment authors and timestamps |
Repositories |
Including ID, Name, and README content as description. |
Files (Markdown only) |
Including Path, Title, Content, MIME type and Extension. |
Workplace Search has been tested for GitHub Enterprise Server version: 3.5.4
Configuring the GitHub Connector
editConfiguring the GitHub connector is the first step prior to connecting the GitHub service to Workplace Search, and requires that you create an OAuth App from the GitHub platform. To get started, first log in to GitHub and access your administrative dashboard:
Step 1. Locate the Account drop-down menu in the top-right area and navigate to Settings:
Step 2. From here, you’ll see a set of menu items on the left under Personal Settings. Click Developer Settings:
Workplace Search needs an OAuth App with which to interface. There are two important things to understand before you create one:
- The app can stay in developer mode. You do not need to publish it.
- Make sure that you create this app with a trusted and stable GitHub account.
We recommend creating a team-owned account for only this app. If access is lost, a new one must be created and the configuration updated in Workplace Search.
Step 3. Click New OAuth App:
You’ll need to fill in specific values:
- Application Name: A name to help you identify the application. It’s best to make it explicit: Workplace Search, or something like that.
- Description (Optional): More information will help you remember the application’s purpose.
-
Homepage URL: Enter the base URL of your Kibana instance.
For standalone Enterprise Search, this will be the Enterprise Search base URL for your deployment.
- Authorization callback URL: Add the Workplace Search OAuth redirect URL for your deployment.
Step 4. Once the form is complete, click Register Application.
Step 5. The app is created, and we may now retrieve the Client ID and Client Secret.
Step 6. From the Workplace Search administrative dashboard’s Sources area, locate GitHub and provide both the Client ID and Client Secret.
Voilà! The GitHub connector is now configured, and ready to be used to synchronize content. In order to capture data, you must now connect a GitHub instance with the adequate authentication credentials.
Connecting GitHub to Workplace Search
editOnce the GitHub connector has been configured, you may connect a GitHub instance to your organization.
Step 1. Head to your organization’s Workplace Search administrative dashboard, and locate the Sources tab.
Step 2. Click Add a new source.
Step 3. Select GitHub (or GitHub Enterprise) in the Configured Sources list, and follow the GitHub authentication flow as presented.
Step 4. Upon the successful authentication flow, you will be redirected to Workplace Search, and will be prompted to select the Organization you would like to synchronize.
GitHub content will now be captured and will be ready for search gradually as it is synced. Once successfully configured and connected, the GitHub synchronization automatically occurs every 2 hours.
Document-level permissions
editYou can synchronize document access permissions from GitHub to Workplace Search. This will ensure the right people see the right documents.
See Document-level permissions for GitHub.
Adding GitHub requires that you belong to and have OAuth permissions within a GitHub organization, usually as a GitHub organization admin-level user.
Limiting the content to be indexed
editIf you don’t need to index all the available content, you can specify the indexing rules via the API. This will help shorten indexing times and limit the size of the index. See Customizing indexing.
For Github and Github Enterprise, applicable rule types would be path_template
and object_type
. When writing path_template
rules, note that Github document paths generally follow their URL value:
https://github.com/elastic /elastic https://github.com/elastic/elasticsearch /elastic/elasticsearch https://github.com/elastic/elasticsearch/projects/2 /elastic/elasticsearch/projects/2 https://github.com/elastic/elasticsearch/issues/77316 /elastic/elasticsearch/issues/77316 https://github.com/elastic/elasticsearch/pull/77320 /elastic/elasticsearch/pull/77320
Synchronized fields
editThe following table lists the fields synchronized from the connected source to Workplace Search. The attributes in the table apply to the default search application, as follows:
- Display name - The label used when displayed in the UI
- Field name - The name of the underlying field attribute
- Faceted filter - whether the field is a faceted filter by default, or can be enabled (see also: Customizing filters)
-
Automatic query refinement preceding phrases - The default list of phrases that must precede a value of this field in a search query in order to automatically trigger query refinement. If "None," a value from this field may trigger refinement regardless of where it is found in the query string. If
''
, a value from this field must be the first token(s) in the query string. IfN.A.
, automatic query refinement is not available for this field by default. All fields that have a faceted filter (default
orconfigurable
) can also be configured for automatic query refinement; see also Update a content source, Get a content source’s automatic query refinement details and Customizing filters.
Display name | Field name | Faceted filter | Automatic query refinement preceding phrases |
---|---|---|---|
Id |
|
No |
N.A. |
URL |
|
No |
N.A. |
Title |
|
No |
N.A. |
Type |
|
Default |
None |
Body |
|
No |
N.A. |
Created at |
|
No |
N.A. |
Updated at |
|
No |
N.A. |
Last updated |
|
No |
N.A. |
Slug |
|
No |
N.A. |
Status |
|
Default |
[ |
Repository |
|
Default |
N.A. |
Created by |
|
Default |
[ |
Assigned to |
|
Default |
[ |
Private |
|
Configurable |
N.A. |
Path |
|
No |
N.A. |
Commented by |
|
No |
[ |