---
title: "Gitea"
description: "Use gitea.com and self-hosted Gitea instances. It shares its implementation with the Forgejo provider."
canonical_url: "https://forges.link/providers/gitea"
---
# Gitea

> Use gitea.com and self-hosted Gitea instances. It shares its implementation with the Forgejo provider.

The Gitea provider works with gitea.com and self-hosted Gitea instances. It shares its implementation with the [Forgejo](https://forges.link/providers/forgejo) provider, so the Forgejo page applies here too, apart from the default instance, the webhook headers and CI. Refs from this provider have `forge: 'gitea'`.

<provider-header provider="gitea">

| Detail | Value |
| --- | --- |
| Import | `forges/gitea` |
| Factories | `gitea()` |
| Auth | `token`, `anonymous` |

</provider-header>

## Authentication

The provider accepts an access token:

```ts
import { gitea } from 'forges/gitea'

const forge = gitea({
  auth: { type: 'token', token: process.env.GITEA_TOKEN! },
})
```

If you leave out `auth`, the provider makes anonymous reads of public data.

## Instance

The default instance is `https://gitea.com`. To use a self-hosted instance, set `baseUrl` to the root of the instance. The provider appends `/api/v1` itself:

```ts
gitea({ baseUrl: 'https://gitea.example.com', auth })
```

`refreshCapabilities()` reads the version of the instance from `/version`.

## Behaviour shared with Forgejo

Because Gitea and Forgejo share an implementation, the following sections of the Forgejo page describe Gitea as well:

- [Marking notifications done](https://forges.link/providers/forgejo#marking-notifications-done)
- [Merging](https://forges.link/providers/forgejo#merging)
- [Reviews](https://forges.link/providers/forgejo#reviews)
- [Branch rules](https://forges.link/providers/forgejo#branch-rules)
- [Changed files](https://forges.link/providers/forgejo#changed-files)
- [Committing files](https://forges.link/providers/forgejo#committing-files)
- [Templates](https://forges.link/providers/forgejo#templates)
- [Listing an owner's repositories](https://forges.link/providers/forgejo#listing-an-owners-repositories)
- [Activity feeds](https://forges.link/providers/forgejo#activity-feeds)
- [Search](https://forges.link/providers/forgejo#search)

## Review replies

`replyToReviewComment()` needs Gitea 1.27 or later. It replies by the comment's `ref`, and the reply joins the same review. gitea.com runs a recent build, so it works there out of the box. For a self-hosted instance, pass `instanceVersion` or call `refreshCapabilities()` first.

## Moderation

`threads.lock()` needs Gitea 1.24 or later, and sends the reason as one of the defaults of Gitea's `LOCK_REASONS` setting, such as `Too heated`. `orgs.block()` and `users.block()` need Gitea 1.22 or later. gitea.com runs a recent build; for a self-hosted instance, pass `instanceVersion` or call `refreshCapabilities()` first. Gitea has no API to hide a comment.

## Checks and CI

`checks.list()` reads commit statuses, and `checks.report()` writes them.

The `ci` methods read Gitea Actions. Runs and their jobs need Gitea 1.25 or later, job logs need Gitea 1.24, and `ci.rerunFailed()` needs Gitea 1.26. gitea.com runs a recent build, so they work there out of the box. For a self-hosted instance, pass `instanceVersion` or call `refreshCapabilities()` first.

Gitea 1.27 lists runs for one workflow directly. An unknown workflow gets you `NotFoundError`. Forgejo just shrugs and returns an empty page.

Before 1.27, `ci.runs()` reads the repository's runs and drops other workflows itself. For workflows in subdirectories, use their relative path, like `sub/ci.yml`, and the provider filters runs itself, even on 1.27. A filtered page can come back shorter than `perPage`, or even empty with a cursor.

Gitea 1.25 is stricter about the list of runs: it shows it only to the owners of the repository and to site admins, and responds with `403` to anyone else. From 1.26, everyone who can read the repository can list its runs. Without a token, Gitea responds with `401` to the list of runs and to job logs, so an anonymous provider can read a run and its jobs, but not list runs or read logs.

Gitea before 28 doesn't say when a run was created, so `createdAt` is unset there.

## Webhooks

To verify deliveries, set `webhookSecret` to the secret that you configured on the hook:

```ts
const forge = gitea({
  webhookSecret: process.env.GITEA_WEBHOOK_SECRET,
})

const events = await forge.webhooks.ingest({
  headers: request.headers,
  body: await request.text(),
})
```

With each delivery, Gitea sends these headers:

| Header | Content |
| --- | --- |
| `X-Gitea-Signature` | The hex HMAC-SHA256 of the body |
| `X-Gitea-Event` | The event name |
| `X-Gitea-Delivery` | The delivery ID |

Unlike the Forgejo provider, the Gitea provider doesn't read `X-Forgejo-*` headers.

A label delivery doesn't say which labels were added or removed. When the set of labels changes, the provider reports a `label` event with the `edited` action, and when every label is removed, a `label` event with the `unlabelled` action.

## Organisation teams

`orgs.teams()` reads `GET /orgs/{org}/teams`, and `orgs.teamMembers()` reads the members of one team. Gitea addresses a team's members by id, so the provider reads `GET /teams/{id}/members` with the ref's `id`. For a ref with only a `slug`, it first resolves the slug (a team's name) to its id with the teams listing. Both need a token with the `read:organization` scope, and Gitea responds with a 403 when the account isn't a member of the organisation. A slug that names no team rejects with `NotFoundError`.

## Capabilities

<provider-capabilities provider="gitea">

| Capability | Support | Without credentials |
| --- | --- | --- |
| `experimental` | ❌ | ❌ |
| `sources.stream` | ❌ | ❌ |
| `repos.get` | ✅ | ✅ |
| `users.get` | ✅ | ✅ |
| `users.me` | ✅ | ❌ |
| `users.sponsorable` | ∅ | ∅ |
| `users.sponsorableMany` | ∅ | ∅ |
| `users.events` | ✅ | ✅ |
| `users.block` | ✅ | ❌ |
| `repos.list` | ✅ | ❌ |
| `repos.byOwner` | ✅ | ✅ |
| `repos.labels` | ✅ | ✅ |
| `repos.createLabel` | ✅ | ❌ |
| `repos.milestones` | ✅ | ✅ |
| `repos.issueTypes` | ∅ | ∅ |
| `repos.collaborators` | ✅ | ❌ |
| `repos.contributors` | ❌ | ❌ |
| `repos.contributorStats` | ❌ | ❌ |
| `repos.templates` | ✅ | ✅ |
| `repos.permissionFor` | ✅ | ❌ |
| `repos.branchRules` | ✅ | ✅ |
| `repos.addCollaborator` | ✅ | ❌ |
| `repos.assignableUsers` | ✅ | ❌ |
| `repos.reviewerCandidates` | ✅ | ❌ |
| `repos.events` | ✅ | ✅ |
| `orgs.teams` | ✅ | ❌ |
| `orgs.teamMembers` | ✅ | ❌ |
| `orgs.block` | ✅ | ❌ |
| `threads.get` | issue, PR | issue, PR |
| `threads.list` | issue, PR | issue, PR |
| `threads.getMany` | ✅ | ✅ |
| `threads.closingIssues` | ❌ | ❌ |
| `threads.closingPullRequests` | ❌ | ❌ |
| `threads.events` | issue, PR | issue, PR |
| `threads.comments` | issue, PR | issue, PR |
| `threads.getComment` | issue, PR | issue, PR |
| `threads.createComment` | issue, PR | ❌ |
| `threads.updateComment` | issue, PR | ❌ |
| `threads.deleteComment` | issue, PR | ❌ |
| `threads.hideComment` | ∅ | ∅ |
| `threads.reactions` | issue, PR | issue, PR |
| `threads.react` | issue, PR | ❌ |
| `threads.create` | issue, PR | ❌ |
| `threads.update` | issue, PR | ❌ |
| `threads.close` | issue, PR | ❌ |
| `threads.reopen` | issue, PR | ❌ |
| `threads.lock` | issue, PR | ❌ |
| `threads.setLabels` | issue, PR | ❌ |
| `threads.addLabels` | issue, PR | ❌ |
| `threads.removeLabels` | issue, PR | ❌ |
| `threads.setMilestone` | issue, PR | ❌ |
| `threads.setIssueType` | ∅ | ∅ |
| `threads.setAssignees` | issue, PR | ❌ |
| `threads.requestReview` | PR | ❌ |
| `threads.merge` | ✅ | ❌ |
| `threads.updateBranch` | ✅ | ❌ |
| `threads.transfer` | ❌ | ❌ |
| `threads.markDuplicate` | ❌ | ❌ |
| `threads.subscription` | issue, PR | ❌ |
| `threads.subscribe` | issue, PR | ❌ |
| `threads.checks` | PR | PR |
| `threads.files` | ✅ | ✅ |
| `threads.commits` | ✅ | ✅ |
| `threads.reviews` | ✅ | ✅ |
| `threads.getReview` | ✅ | ✅ |
| `threads.createReview` | ✅ | ❌ |
| `threads.submitReview` | ✅ | ❌ |
| `threads.approve` | ✅ | ❌ |
| `threads.replyToReviewComment` | ✅ | ❌ |
| `threads.reviewThreads` | emulated | emulated |
| `threads.resolveReviewThread` | ∅ | ∅ |
| `notifications.list` | ✅ | ❌ |
| `notifications.markRead` | ✅ | ❌ |
| `notifications.markDone` | emulated | ❌ |
| `notifications.unsubscribe` | ✅ | ❌ |
| `notifications.markAllRead` | ✅ | ❌ |
| `notifications.markAllDone` | ❌ | ❌ |
| `notifications.unreadCount` | ✅ | ❌ |
| `installations.list` | ❌ | ❌ |
| `checks.list` | ✅ | ✅ |
| `checks.get` | ❌ | ❌ |
| `checks.report` | ✅ | ❌ |
| `checks.rerun` | ∅ | ∅ |
| `ci.runs` | ✅ | ❌ |
| `ci.getRun` | ✅ | ✅ |
| `ci.jobs` | ✅ | ✅ |
| `ci.getJob` | ✅ | unverified |
| `ci.log` | ✅ | ❌ |
| `ci.rerunFailed` | ✅ | ❌ |
| `contents.getFile` | ✅ | ✅ |
| `contents.tree` | ✅ | ✅ |
| `contents.branches` | ✅ | ✅ |
| `contents.tags` | ✅ | ✅ |
| `contents.resolveRef` | ✅ | ✅ |
| `contents.compare` | ✅ | ✅ |
| `contents.commitFiles` | ✅ | ❌ |
| `commits.list` | ✅ | ✅ |
| `commits.get` | ✅ | ✅ |
| `commits.comments` | ❌ | ❌ |
| `commits.getComment` | ❌ | ❌ |
| `commits.createComment` | ❌ | ❌ |
| `commits.updateComment` | ❌ | ❌ |
| `commits.deleteComment` | ❌ | ❌ |
| `commits.hideComment` | ❌ | ❌ |
| `releases.list` | ✅ | ✅ |
| `releases.get` | ✅ | ✅ |
| `releases.latest` | ✅ | ✅ |
| `releases.getByTag` | ✅ | ✅ |
| `releases.downloadAsset` | ✅ | ✅ |
| `releases.create` | ✅ | ❌ |
| `releases.update` | ✅ | ❌ |
| `webhooks.ingest` | ✅ | ✅ |
| `webhooks.list` | ✅ | ❌ |
| `webhooks.create` | ✅ | ❌ |
| `webhooks.update` | ✅ | ❌ |
| `webhooks.delete` | ✅ | ❌ |
| `webhooks.rotateSecret` | ✅ | ❌ |
| `webhooks.deliveries` | ∅ | ∅ |
| `webhooks.redeliver` | ∅ | ∅ |
| `search.threads` | ✅ | ✅ |
| `search.repos` | ✅ | ✅ |
| `search.commits` | ❌ | ❌ |
| `search.code` | ❌ | ❌ |
| `securityAlerts.list` | ❌ | ❌ |
| `eventKinds` | native | native |
| `authKinds` | `token`, `anonymous` | `token`, `anonymous` |
| `limits` | unknown | unknown |

</provider-capabilities>


## Sitemap

See the full [sitemap](https://forges.link/sitemap.md) for all pages.
