Skip to content

Fix private repository access handling#10

Open
abhishek-anand wants to merge 4 commits intomainfrom
private_repo
Open

Fix private repository access handling#10
abhishek-anand wants to merge 4 commits intomainfrom
private_repo

Conversation

@abhishek-anand
Copy link
Copy Markdown
Contributor

Summary

  • Improved error handling for private repository access failures with specific error messages
  • Added GitHub Personal Access Token support for private repository access
  • Enhanced user experience with contextual token input that appears only when needed

Test plan

  • Test public repository access (should work as before)
  • Test private repository access without token (should show clear error message)
  • Test private repository access with valid token (should work)
  • Verify token input only appears when private repo error occurs
  • Confirm token is not stored and used only for current request

Changes Made

Backend

  • Enhanced GitHub API error handling with specific messages for 403/404 responses
  • Added user token parameter to GitHubService constructor
  • Updated API request models to accept github_token field
  • Modified service instantiation to use user tokens when provided

Frontend

  • Added contextual GitHub token input that appears only after private repo errors
  • Included helpful documentation link for token creation
  • Used password input type for security
  • Added clear messaging about token usage and storage

- Add specific error messages for 403 and 404 HTTP responses
- Distinguish between repository not found and access denied scenarios
- Provide clear feedback when authentication is required for private repos
- Update all GitHub API methods with proper error handling
- Wrap repository data fetching in try-catch blocks in API endpoints

Fixes issue where private repository access failures showed generic errors
instead of informative messages guiding users toward authentication.
- Update GitHubService to accept user-provided tokens
- Modify API request models to include github_token field
- Update frontend to show token input only when private repo error occurs
- Add informative help text with link to GitHub documentation
- Update fetch-backend functions to pass GitHub tokens to API
- Maintain token security by using password input and not storing tokens

This enables users to access their private repositories by providing
a GitHub Personal Access Token when needed, with a user-friendly
interface that appears contextually when private repo access fails.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @abhishek-anand, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces significant enhancements to how the application interacts with GitHub repositories, particularly private ones. The primary goal is to enable users to access their private repositories by providing a GitHub Personal Access Token, while also greatly improving the clarity and specificity of error messages when repository access fails due to permissions or non-existence. This makes the application more robust and user-friendly for private repository workflows.

Highlights

  • Private Repository Access: Implemented support for GitHub Personal Access Tokens (PATs) to allow users to access private repositories, enhancing the application's utility for a wider range of GitHub projects.
  • Enhanced Error Handling: Improved error handling for GitHub API calls, providing more specific and user-friendly messages for 403 (Forbidden) and 404 (Not Found) responses, guiding users on how to resolve access issues.
  • Backend Integration: Modified API request models (ApiRequest, SlideRequest) to accept a github_token and updated the get_cached_github_data function to dynamically instantiate GitHubService with the provided token, ensuring secure and authenticated access.
  • GitHub Service Refinement: The GitHubService now prioritizes user-provided tokens for authentication and includes more robust error propagation for various GitHub API interactions (e.g., fetching default branch, file tree, README, or file content).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@abhishek-anand abhishek-anand requested a review from mkagenius July 20, 2025 19:58
@abhishek-anand
Copy link
Copy Markdown
Contributor Author

#2

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the application by adding support for private repositories and improving error handling. The changes are well-structured and the intent is clear. The review focuses on improving API error handling and reducing code duplication to enhance maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant