dsh-plugin-forge-forgejo: Reading and Writing PRs and Reviews on Forgejo/Gitea via DeepSeek Harness

Introduction

The “Change requests & worktrees” (forge) module of DeepSeek Harness (DSH) allows agents to operate on remote code repositories as if they were local ones. However, by default, it lacks Provider support for Forgejo (Gitea-compatible) instances. When developers need to directly manage Pull Requests, reviews, and check statuses of Forgejo repositories within DSH’s Change Request panel, a dedicated Provider is required. dsh-plugin-forge-forgejo is designed for exactly that purpose.

What Is This

dsh-plugin-forge-forgejo is a DSH plugin that provides Forgejo (and Gitea-compatible) repository read and write capabilities to DeepSeek Harness. It performs various PR operations through the host’s REST API using a single access token. The maintainer is Iaotle, and it belongs to the “Network Tools” category.

The plugin is mounted via DSH’s Forge Registry, mapping Forgejo Pull Requests to DSH Change Requests, Actions runs to Checks, and review threads to Review Threads. This allows agents to view, comment, submit reviews, merge code, update branches, and more—all within the same panel.

Core Features

The plugin reads and writes Forgejo Pull Requests via the REST API, supporting the following capabilities:

Read Capabilities

  • PR status, changed lines, commit status, and Actions runs as Checks
  • Reviewers and Reviews (including comments and review opinions)
  • Mergeability (merge feasibility)
  • Unresolved Review Conversations
  • Issues closed via closes, fixes, resolves (and their variants) keywords in the PR description
  • Changes View: reads PR diff (anchored at head), commits, and review threads
  • Branch update capability: when the head branch is behind the base branch, there are no conflicts, they are in the same repository, and the user has push permissions, supports merge and rebase

Write Capabilities

  • Post comments, submit reviews, and reply to comments
  • Edit and delete comments
  • Maintain a “pending review” (pending review): replies without pending are published as single-comment reviews, while replies with pending are added to the pending review
  • Mark drafts as ready (remove the WIP: or [WIP] prefix from the title)
  • Merge PRs (supports merge, rebase, squash; prefers the repository’s default merge method)
  • Re-run failed Checks (rerun Checks)
  • Request reviews (requestReviews)
  • Update the head branch (updateBranch)

Installation and Enablement

Prerequisites

  • DeepSeek Harness 0.2.3-alpha.1 or higher
  • The “Change requests & worktrees” (forge) bundle must be enabled

Installation

dsh plugin --profile <name> add dsh-plugin-forge-forgejo          # from npm
dsh plugin --profile <name> add github:Iaotle/dsh-plugin-forge-forgejo#<sha>   # from git (needs allowBuilds, see below)

After installation, the plugin is added to the configuration in a disabled state. You need to manually enable it and specify the host in the configuration file.

Configuration

Enable the plugin and configure the host in the profile’s cordis.patch.yml:

- id: forge-forgejo
  disabled: false
  config:
    hosts: [git.example.com]

Credential Setup

Store the access token as the FORGEJO_TOKEN credential. The token should be created under Settings → Applications on the Forgejo host, with the following permission scopes:

  • read:user
  • write:repository
  • write:issue

The token can also contain only read:user to still satisfy read requirements. The access token is read via the environment variable FORGEJO_TOKEN and can be rotated without a restart.

Git Installation Note

If installing via Git, the installation script runs prepare to build the lib/ directory. In this case, ensure that the profile’s pnpm-workspace.yaml includes allowBuilds: { dsh-plugin-forge-forgejo: true }, otherwise the build will fail.

Typical Usage

Mounting the Provider

In DSH’s configuration, the Forge Registry must be mounted first, followed by the Forgejo Provider. There is no default host—you must explicitly list them:

- name: '@deepseek-ai/dsh-experimental-forge'
- name: '@deepseek-ai/dsh-forge-forgejo'
  config:
    hosts: [git.example.com]
    tokenEnv: FORGEJO_TOKEN

tokenEnv specifies the environment variable to read the token from, defaulting to FORGEJO_TOKEN.

Reading PR Information

The Provider maps Forgejo Pull Requests to DSH Change Requests. DSH will read:

  • PR status and changed lines
  • Commit status and Actions runs (as Checks)
  • Reviewers and Reviews (including comments)
  • Mergeability flag
  • Issues closed in the description (re-read when the PR update timestamp changes)

The merge condition requires: the PR is open, not a draft, mergeable, the user can merge into the base branch, required approvals are met, and required checks have passed.

Submitting Reviews

When submitting reviews, two modes are supported:

  • Replies without pending: published as a single-comment review.
  • Replies and comments with pending: added to the pending review. If no pending review exists, one is created; if the review is rejected, the pending review is removed.

You can submit a pending review via submit-pending and discard a pending review via discard-pending.

Merging PRs

The merge operation sets head_commit_id to the current head commit. If head has moved, Forgejo returns HTTP 409; if the merge is rejected, it returns HTTP 405 “Please try again later”. Both cases are reported as stale or failed.

Updating Branches

When the head branch is behind the base branch, there are no conflicts, they are in the same repository, and the user has push permissions, you can use branchUpdates to perform a merge or rebase.

Use Cases and Cautions

This plugin is suitable for agent developers who need to directly operate Forgejo/Gitea repositories within DSH, for example:

  • Automating code review workflows
  • CI/CD integration dependent on Actions checks
  • Multi-repository PR management
  • Scenarios requiring remote PR management through the DSH Change Request panel

Cautions:

  • The plugin runs with the privileges of the current DSH process. Review the source code and license (MIT) before installing.
  • Ensure the Forgejo host’s REST API is accessible (HTTPS only).
  • All write operations do not automatically retry: 4xx responses are treated as failed, 401 as unauthenticated, and 5xx or requests that may have reached the host as unknown.

Conclusion

dsh-plugin-forge-forgejo fully integrates the Forgejo/Gitea Pull Request ecosystem into DeepSeek Harness, enabling agents to complete the entire workflow—from reading PRs, submitting reviews, and requesting approvals to merging code—within a single panel. It achieves this through the REST API with a single access token, reducing the complexity of permission management. It is well-suited for agent workflows that require deep integration with Forgejo repositories.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye