-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add Forgejo integration similar to GitHub and GitLab integrations #8418
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
Conversation
… and improved documentation
…Conversations model
|
@erkinalp were you able to verify this works? Can you post a screenshot showing Forgejo repositories in the homepage repo picker? |
… add metadata to microagent, and fix type annotations
| - Forgejo uses `limit` instead of `per_page` for pagination | ||
| - Forgejo uses `stars_count` instead of `stargazers_count` for repository stars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - Forgejo uses `limit` instead of `per_page` for pagination | |
| - Forgejo uses `stars_count` instead of `stargazers_count` for repository stars | |
| - Forgejo uses `limit` instead of `per_page` for pagination |
Some of these instructions may be unnecessary? Could be helpful to cull the information down to things that the agent would require pointers on to work well in most agent use cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
star count is sometimes relevant for search&local sort purposes
| ## Using the Forgejo Integration | ||
|
|
||
| To use the Forgejo integration in OpenHands: | ||
|
|
||
| 1. Generate a personal access token from your Forgejo instance (e.g., Codeberg) | ||
| 2. Set the token as an environment variable: `FORGEJO_TOKEN` | ||
| 3. Use the Forgejo provider in your code | ||
|
|
||
| Example: | ||
| ```python | ||
| from openhands.integrations.service_types import ProviderType | ||
| from openhands.integrations.provider import ProviderHandler | ||
| from pydantic import SecretStr | ||
|
|
||
| # Create a provider handler with Forgejo token | ||
| provider_handler = ProviderHandler({ | ||
| ProviderType.FORGEJO: ProviderToken(token=SecretStr("your_token")) | ||
| }) | ||
|
|
||
| # Get user information | ||
| user = await provider_handler.get_user() | ||
|
|
||
| # Search repositories | ||
| repos = await provider_handler.search_repositories("query", 10, "updated", "desc") | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, probably information that can be left out
The microgent is additional context that's incorporated in the agent's memory at runtime
| - Forgejo uses `stars_count` instead of `stargazers_count` for repository stars | ||
| - Forgejo organizes code review comments differently, using "CodeConversations" for comments on the same line | ||
| - Forgejo doesn't support replying to specific comments in the same way as GitHub, but our implementation provides a workaround | ||
| - Forgejo doesn't support GraphQL, only REST API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - Forgejo doesn't support GraphQL, only REST API | |
| - Forgejo doesn't support GraphQL, only REST and ActivityPub |
|
This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
still pursuing |
|
This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
This PR was closed because it has been stalled for over 30 days with no activity. |
|
@erkinalp are you sill pursuing this pr? |
End-user friendly description of the problem this fixes or functionality that this introduces.
This PR adds support for Forgejo, a self-hosted Git service that is a fork of Gitea. With this integration, users can now interact with Forgejo instances like Codeberg.org in the same way they interact with GitHub and GitLab. This enables browsing repositories, viewing issues and pull requests, and creating pull requests on Forgejo platforms.
Give a summary of what the PR does, explaining any non-trivial design decisions.
This PR implements a Forgejo integration similar to the existing GitHub and GitLab integrations. It includes:
ForgejoServiceclass that implements theGitServiceprotocolForgejoIssueHandlerandForgejoPRHandlerfor the resolver interfaceProviderTypeenum to include ForgejoProviderHandlerclass to support the Forgejo serviceThe implementation follows the same patterns as the existing GitHub and GitLab integrations, making it easy to understand and maintain. The Forgejo API is similar to the GitHub API, but there are some differences in endpoint names and response formats that are handled in the implementation.
The integration has been tested against Codeberg.org, a popular Forgejo instance, and works correctly for browsing repositories, searching, and other operations.
Link of any specific issues this addresses.
N/A