> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lightdash.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub

> Query pull requests, issues and contributors of a GitHub repository live from Explore and AI agents

The GitHub [live source](https://docs.lightdash.com/integrations/live-sources) reads the pull requests, issues and contributor statistics of one GitHub repository.

## Before you start

* **A fine-grained personal access token** with the permissions below, from **Settings** → **Developer settings** → **Personal access tokens** → **Fine-grained tokens** in GitHub.

## Scopes

Give the token **Read-only** access to these repository permissions.

| Permission | Why |
| - | - |
| **Metadata** | Reads the repository and its contributor stats, for **Contributors**. GitHub adds it to every token |
| **Issues** | Reads issues, for **Issues** |
| **Pull requests** | Reads pull requests, for **Pull requests** |

## Connect GitHub

[Add a live source](https://docs.lightdash.com/integrations/live-sources/set-up-and-manage.md#connect-a-live-source), select **GitHub**, and enter the **Repository** as `owner/name` and the **Personal access token**.

![The Add GitHub source dialog, with a Scopes card listing Metadata, Issues and Pull requests, an Authentication card with the Repository and Personal access token fields and a Test button, a Details card with the Name field, and the Add source button](https://mintcdn.com/lightdash/WuPlti30p6CHhcUC/images/integrations/live-sources/github-config.png?fit=max\&auto=format\&n=WuPlti30p6CHhcUC\&q=85\&s=b8858454544a541cab1919d11e95e2bf)

## Semantic layer

### Pull requests

Pull requests in one GitHub repository

| Field | Description |
| - | - |
|  Number | The pull request number in the repository |
|  Title | Title of the pull request |
|  URL | Link to the pull request on GitHub |
|  Author | GitHub username of the person who opened the pull request |
|  Assignee | GitHub username of the first person assigned to the pull request |
|  Labels | Labels on the pull request, separated by commas |
|  Comments | Number of comments |
|  Created | Day the pull request was opened, in UTC |
|  Updated | Day the pull request last changed, in UTC |
|  Closed | Day the pull request was closed, in UTC |
|  Search text | Words to look for in the title or description |
|  State | Whether the pull request is open, merged, or closed without merging |
|  Draft | Whether the pull request is a draft |
|  Merged | Day the pull request was merged, in UTC |
|  Count | Number of pull requests that match the filters |

### Issues

Issues in one GitHub repository, not including pull requests

| Field | Description |
| - | - |
|  Number | The issue number in the repository |
|  Title | Title of the issue |
|  URL | Link to the issue on GitHub |
|  Author | GitHub username of the person who opened the issue |
|  Assignee | GitHub username of the first person assigned to the issue |
|  Labels | Labels on the issue, separated by commas |
|  Comments | Number of comments |
|  Created | Day the issue was opened, in UTC |
|  Updated | Day the issue last changed, in UTC |
|  Closed | Day the issue was closed, in UTC |
|  Search text | Words to look for in the title or description |
|  State | Whether the issue is open or closed |
|  State reason | Why a closed issue was closed: `completed`, `not_planned`, `duplicate` or `reopened` |
|  Count | Number of issues that match the filters |

### Contributors

Weekly commits, lines added and lines deleted per author on the repository's default branch

| Field | Description |
| - | - |
|  Author | GitHub username of the commit author |
|  Week | Week of the commits, shown as its Sunday, in UTC |
|  Commits | Number of commits on the default branch |
|  Lines added | Number of lines added |
|  Lines deleted | Number of lines deleted |

## Limits

| Limit | Value |
| - | - |
| Most rows per query | 999. GitHub search returns at most 1,000 results |
| Contributors | Top 100. Lines added and Lines deleted are 0 for repositories with 10,000 commits or more |

A query sorted by anything other than Created, Updated or Comments that matches more than 999 items shows an error rather than a partial result. Add a filter, such as a date range.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.