Skip to content

Conversation

@erkinalp
Copy link
Contributor

  • This change is worth documenting at https://docs.all-hands.dev/
  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

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:

  1. A new ForgejoService class that implements the GitService protocol
  2. A new ForgejoIssueHandler and ForgejoPRHandler for the resolver interface
  3. Updates to the ProviderType enum to include Forgejo
  4. Updates to the ProviderHandler class to support the Forgejo service
  5. A new microagent knowledge file for Forgejo
  6. Comprehensive unit tests for the Forgejo service
  7. Documentation for the Forgejo integration

The 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

@erkinalp erkinalp requested a review from mamoodi as a code owner May 10, 2025 10:20
@mamoodi mamoodi requested review from malhotra5 and rbren May 12, 2025 13:33
@rbren
Copy link
Collaborator

rbren commented May 12, 2025

@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
@erkinalp erkinalp requested a review from rbren May 12, 2025 16:51
Comment on lines +66 to +67
- Forgejo uses `limit` instead of `per_page` for pagination
- Forgejo uses `stars_count` instead of `stargazers_count` for repository stars
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- 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

Copy link
Contributor Author

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

Comment on lines +80 to +104
## 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")
```
Copy link
Collaborator

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
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
- Forgejo doesn't support GraphQL, only REST API
- Forgejo doesn't support GraphQL, only REST and ActivityPub

@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot added the Stale Inactive for 40 days label Jun 15, 2025
@erkinalp
Copy link
Contributor Author

still pursuing

@github-actions github-actions bot removed the Stale Inactive for 40 days label Jun 16, 2025
@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot added the Stale Inactive for 40 days label Jul 16, 2025
@github-actions
Copy link
Contributor

This PR was closed because it has been stalled for over 30 days with no activity.

@github-actions github-actions bot closed this Jul 23, 2025
@IMbackK
Copy link

IMbackK commented Aug 11, 2025

@erkinalp are you sill pursuing this pr?

@johba37 johba37 mentioned this pull request Sep 25, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stale Inactive for 40 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants