8000 feat(web-ui): add private-GitHub ingestion via PAT by filipchristiansen · Pull Request #286 · cyclotruc/gitingest · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(web-ui): add private-GitHub ingestion via PAT #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

filipchristiansen
Copy link
Collaborator

Why

Until now the gitingest.com web UI could ingest only public repositories.
Teams often need to analyse private GitHub repos, so we’re adding a way to supply a personal access token (PAT).

What’s inside

Area Key changes
UI • New “🔒 Private Repository” checkbox in git_form.jinja that reveals a masked PAT field.
• Checkbox state + token are posted with the form.
Server routes index.py, dynamic.py, query_processor.py accept token from the form and thread it downstream.
Ingestion stack gitingest.entrypoint.parse_query and query_parsing now carry token, letting try_domains_for_user_and_repo() resolve bare user/repo slugs against GitHub also when a PAT is present.
Tests • Added "token": "" to form_data in tests/test_flow_integration.py to keep path-coverage intact.

Limitation: This PR enables PAT-protected cloning only for GitHub; other hosts (GitLab, Gitea, etc.) remain public-only for now.

…authentication

* Accept a GitHub personal access token (PAT) from the UI and forward it through
  - `git_form.jinja` → new “Private Repository” checkbox + PAT field
  - routers (`index.py`, `dynamic.py`) and `query_processor.py`
* Propagate `token` throughout the ingestion stack
  - `gitingest.entrypoint.parse_query`
  - `query_parsing` (including `try_domains_for_user_and_repo`) so we can infer the host when the user enters a bare “user/repo” slug
* Tests
  - Added `"token": ""` to the `form_data` dict in the tests in `tests/test_flow_integration.py`

**Limitation:** This PR enables PAT-protected cloning **only for GitHub**; other hosts (GitLab, Gitea, etc.) remain public-only for now.
@filipchristiansen filipchristiansen requested review from Copilot and cyclotruc and removed request for Copilot June 20, 2025 12:15
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for supplying a GitHub personal access token (PAT) so private repos can be ingested through the web UI and backend.

  • UI: New “Private Repository” checkbox and masked PAT field in the ingest form
  • Backend: Thread token from HTTP form through routers, process_query, parsing, and clone_repo
  • Tests: Updated integration and unit tests to include token in form data and clone calls

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_repository_clone.py Renamed test variables to clone_config and updated assertions
tests/test_flow_integration.py Added "token": "" to all form_data entries
src/server/templates/components/git_form.jinja Inserted PAT checkbox, input field, and toggle logic
src/server/routers/index.py Accept token in form, normalize empty token to None
src/server/routers/dynamic.py Same updates as index router for catch-all paths
src/server/query_processor.py Forward token into clone_repo call
src/gitingest/query_parsing.py Extend parse_query and _parse_remote_repo to accept token
src/gitingest/entrypoint.py Pass token into parse_query
Comments suppressed due to low confidence (2)

tests/test_flow_integration.py:66

  • Consider adding test cases where a non-empty token is provided to cover the private-repo ingestion path and assert that the token is passed downstream correctly.
        "token": "",

src/gitingest/query_parsing.py:26

  • Add validation to ensure the provided token matches the expected GitHub PAT format (e.g. starts with 'github_pat_' or 'gph_') and reject or warn on invalid values.
async def parse_query(

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
0