Synced from Hive. This page is pulled from hivecommons/hive@v5 during the docs build. Edit the canonical source in the Hive repository.

Forgejo

Audience

This page is for teams whose repositories live on Forgejo, on their own instance or on Codeberg, and who want to know what Hive does with Forgejo today. It is written from v5 code. The full forge reference, which covers GitLab and Gitea too, is Forges: GitLab, Gitea and Forgejo.

Status: partial, in progress

A Forgejo-only hive does not do agent work yet. Hive has a first-class forgejo forge kind, and a hive with every repository on Forgejo boots without GitHub credentials. The governor still discovers work through GitHub only, so such a hive finds nothing to do. Agents cannot yet clone from or push to a Forgejo host. The remaining work is tracked in #19494 and #19493. This page is updated as each piece merges.

What Forgejo is

Forgejo is a self-hosted software forge: Git hosting, issues, pull requests, packages and CI in one service. It is community-run, started as a fork of Gitea, and is developed under the umbrella of Codeberg e.V., the non-profit that runs codeberg.org. Forgejo serves a Gitea-compatible REST API under /api/v1.

What works on v5 today

AreaState on v5
Forge kindproject.forge: forgejo and forge: forgejo on a project.repo_policies[] entry are valid, with a top-level forgejo: block. Forgejo is its own kind, separate from gitea, so a call that differs between the two can change for one without the other (#19496).
Config load without GitHubWhen project.forge is forgejo and no repo_policies entry puts a repository on GitHub, validation does not ask for github.token, github.app_id or github.forge. It requires forgejo.forgejo_url (or a forge_url on each repo’s policy) instead (#19497).
Token handlingFORGEJO_TOKEN, and the variable forgejo.token_env names, is stripped from agent panes, user sessions and tool shells (#19498). The token is only sent to the host of the forgejo: block’s URL. A repo_policies[].forge_url on another host fails config load (#19572).
Adapter callsThe Forgejo adapter in src/pkg/forge/forgejo_forge.go reads a repository, lists open issues and pull requests, comments, adds and removes labels, sets the hold label, and merges a pull request with a hold gate and an optional head-SHA guard. Unit tests run against a fake server. The nightly Forgejo smoke workflow runs read, comment, label and merge against a real Forgejo container.
Dashboard and toolsA Projects card on a Forgejo repository names Forgejo and its host and links to the instance’s /issues and /pulls pages. The Settings dialog has Forgejo URL and token variable fields. hivectl presets, the hub forge switch and the proxy deny messages accept forgejo.

The adapter calls exist, but on a Forgejo-only hive nothing reaches them yet, because the governor cycle that would call them starts from GitHub. What runs through the adapter today has the details.

In progress

None of these has merged on v5. Each links to the issue that tracks it.

  • Work discovery through the forge adapter, so the governor finds issues and pull requests on Forgejo (#19494, item 3).
  • Clone and push to the Forgejo host, with credentials from the proxy (#19494, item 4).
  • Issue and pull request creation through the forge, and the request-file watchers (#19494, item 5).
  • Automerge and close-on-merge sweeps for Forgejo repositories (#19494, item 6).
  • Short-lived, per-tier Forgejo credentials signed by the hive (#19493, open PR #19576).

The hub’s get-started flow provisions hosted hives on GitHub and GitHub Enterprise only. A Forgejo repository URL is refused there for now.

Configure a Forgejo repository in hive.yaml

These keys parse and validate on v5. Setting them gives you a hive that loads and shows your Forgejo repositories on the dashboard. It does not yet give you agents that work on them.

project:
  org: my-org                 # the Forgejo owner (user or organization)
  repos:
    - my-repo
  forge: forgejo              # "github" (default) | "gitlab" | "gitea" | "forgejo"
 
forgejo:
  forgejo_url: https://codeberg.org   # bare instance root; no default
  token_env: FORGEJO_TOKEN            # env var NAME, never the token

Put the Forgejo access token in the environment variable that token_env names. The token never goes in hive.yaml.

To keep most repositories on GitHub and put one on Forgejo, use a repository policy. Its forge_url must be on the same host and port as forgejo.forgejo_url, because the block’s token is only sent to that host:

project:
  repo_policies:
    - repo: mirror
      forge: forgejo
      forge_url: https://codeberg.org
KeyDefaultNotes
project.forgegithubforgejo selects the Forgejo adapter for every repository in project.repos.
forgejo.forgejo_urlnoneInstance root, for example https://codeberg.org or https://forgejo.example.com. The adapter appends /api/v1 itself, so do not add it.
forgejo.token_envFORGEJO_TOKENName of the environment variable that holds the token. Sent as Authorization: token <TOKEN>.
project.repo_policies[].forgeproject.forgeMoves one repository to forgejo.
project.repo_policies[].forge_urlforgejo.forgejo_urlBare instance root for that repository. Must match the block’s host and port.

The keys come from ForgejoConfig in src/pkg/config/config.go and the repository policy fields in src/pkg/config/repo_policy.go. Do not confuse project.forge with github.forge, which names a GitHub host for the GitHub App. See Forge setup.

Credits

The Forgejo work on v5 (the forgejo forge kind, GitHub-free config load, forge token stripping and the token host check) was contributed by sdwilsh, who also wrote the plan in #19493 and #19494.

The Forgejo logo was created by Caesar Schinas and is licensed under CC BY-SA 4.0. It is used unmodified from the Forgejo source tree; the license is stated on the Forgejo branding page. Logos are trademarks of their owners and are used for identification only. See Logo sources and licenses.

See also