Skip to main content

Get User Repositories

Fetches the authenticated user’s GitHub repositories. Only available for users authenticated via GitHub OAuth.

Headers

string
required
Bearer token for authentication

Response

array
Array of GitHub repositories accessible to the user

Implementation Details

Authentication Requirements

  • User must be authenticated via GitHub OAuth
  • The user’s provider field must be set to github
  • Requires a valid githubAccessToken stored in the user’s profile

GitHub API Integration

  • Makes a request to https://api.github.com/user/repos
  • Uses the stored GitHub access token for authorization
  • Includes Accept: application/vnd.github+json header for GitHub API v3

Query Parameters

The endpoint queries GitHub with the following parameters:
string
default:"all"
Returns both public and private repositories
string
default:"owner,collaborator"
Returns repositories the user owns or collaborates on
number
default:"100"
Maximum number of repositories to return (100 is GitHub’s limit per page)

User Model Fields

The implementation uses the following fields from the User model:

Use Cases

  • Display available repositories for deployment selection
  • Allow users to connect their GitHub projects to DeployHub
  • Filter repositories for deployment configuration
  • Show repository metadata during project creation

Error Responses

Returned when the user’s provider is not github.
Returned when the user doesn’t have a GitHub access token stored.
Returned when there’s an error communicating with the GitHub API or an internal server error.

GitHub OAuth Scopes

The GitHub OAuth integration requires the following scopes:
  • repo - Full control of private repositories
  • user:email - Access user email addresses
  • admin:repo_hook - Repository webhooks for deployment triggers