Skip to Content

Setting up a GitHub Integration

The GitHub integration supports two authentication methods: Personal Access Token (PAT) and GitHub App. Choose the method that best aligns with your organization’s security requirements.

Prerequisites

  • A CloudQuery Platform account with admin access
  • A GitHub account with access to the repositories or organizations you want to sync
  • For GitHub App authentication: organization admin access to create and install apps

GitHub Apps have higher rate limits than personal access tokens. For organizations with many repositories, GitHub App authentication is recommended.

Personal Access Token authentication

Generate a token

  1. Go to your GitHub account Settings
  2. Navigate to Developer settingsPersonal access tokensTokens (classic)
  3. Click Generate new token and select Generate new token (classic)
  4. Name your token (e.g. cloudquery-readonly)
  5. Set an expiration period
  6. Select the following scopes based on the data you want to sync:
ScopeRequired for
repo (read-only)Repository metadata, issues, pull requests, commits
read:orgOrganization members, teams, settings
read:userUser profile information
read:projectGitHub Projects data
read:packagesGitHub Packages metadata
  1. Click Generate token and copy the token value.

For detailed instructions, see the GitHub personal access token documentation.

Create the integration with PAT

  1. In CloudQuery Platform, go to Data PipelinesIntegrations. Click Create Integration and type GitHub to find the GitHub integration.

Find GitHub Integration

  1. Choose a name for your integration. Under Select authentication type, choose Access Token, then enter your personal access token in the Access Token field.

  2. Under Configuration, select Organizations or Repositories and enter the relevant names.

  3. Click Continue to select the tables you want to sync.

  4. Click Test and Continue to verify the setup.

GitHub App authentication

Create a GitHub App

GitHub App authentication provides higher rate limits and fine-grained permissions. For detailed setup instructions, see the GitHub App registration documentation.

  1. Go to your Organization SettingsDeveloper settingsGitHub AppsNew GitHub App
  2. Configure the app:
    • Set a name (e.g. CloudQuery Integration)
    • Set the homepage URL to your organization’s URL
    • Deselect Webhook (not needed)
    • Under Permissions, grant read-only access to the resources you want to sync (e.g., Repository: Contents, Issues, Pull requests, Metadata; Organization: Members)
  3. Click Create GitHub App
  4. On the app settings page, note the App ID
  5. Scroll down to Private keys and click Generate a private key. This downloads a .pem file.
  6. Go to Install App in the left sidebar and install it on your organization. Note the Installation ID from the URL (e.g., https://github.com/settings/installations/<INSTALLATION_ID>)

For a full list of permissions required per resource type, see the GitHub App permissions reference.

Create the integration with GitHub App

  1. In CloudQuery Platform, go to Data PipelinesIntegrations. Click Create Integration and type GitHub to find the GitHub integration.

  2. Choose a name for your integration. Github app authentication is selected by default. Enter your App ID, Installation ID, and Private Key in the fields provided. Paste the entire contents of the .pem file into the Private Key field.

  3. Under Configuration, select Organizations or Repositories and enter the relevant names.

  4. Click Continue to select the tables you want to sync.

  5. Click Test and Continue to verify the setup.

What gets synced

The GitHub integration syncs repository, organization, and security data. Some of the most commonly used tables include:

CategoryTablesDescription
Repositoriesgithub_repositoriesRepository metadata, settings, visibility
Issues & PRsgithub_issues, github_pull_requestsIssues, pull requests, and their metadata
CI/CDgithub_workflow_runsGitHub Actions workflow run history
Securitygithub_code_scanning_alerts, github_secret_scanning_alertsCode scanning and secret scanning findings
Organizationgithub_organization_members_with_roleOrg members and their roles

See the full GitHub table list for all available tables.

Verify the integration

After your first sync completes, open the SQL Console and run these queries to confirm data arrived:

-- Count synced repositories SELECT count(*) FROM github_repositories
-- List synced organizations SELECT DISTINCT org FROM github_repositories
-- View recent issues SELECT repository_full_name, title, state, created_at FROM github_issues ORDER BY created_at DESC LIMIT 10
-- Check pull request activity SELECT repository_full_name, title, state, created_at FROM github_pull_requests ORDER BY created_at DESC LIMIT 10

You can also browse your GitHub resources in the Asset Inventory.

Troubleshooting

IssueCauseFix
401 UnauthorizedInvalid or expired tokenGenerate a new PAT or rotate the GitHub App private key. Verify the secret value in CloudQuery Platform matches.
403 ForbiddenInsufficient token scopesCheck that the PAT has the required scopes (see the scopes table above). For GitHub Apps, verify the app has the necessary permissions.
Rate limit exceededToo many API requestsGitHub Apps have higher rate limits than PATs. Consider switching to GitHub App authentication. You can also reduce the number of tables or repositories synced.
404 Not FoundRepository or organization not accessibleVerify the Repositories or Organizations values in the form match existing repositories/organizations that the token or app has access to.
No data after syncEmpty repositories or organizations listVerify that at least one Repository is entered in owner/repo format, or switch to Organizations and enter at least one organization name.

Next steps

Was this page helpful?

Last updated on