Gives Archon workflows what they need to run governed work on a Forgejo or Gitea item: the
pull request's checks and files, the reviews on it, a marked comment written in place, labels,
and a qualified merge. It speaks the @archon/forge plugin protocol (version 1) and talks to
the /api/v1 REST API of the instance.
Codeberg and gitea.com are claimed by default; any other instance is mapped under forge.hosts.
archon plugin add KIntegrated/archon-forge-forgejoPin a release with @v0.4.0. The executable is installed under ARCHON_HOME/plugins/ and
verified against the release's checksums.txt.
Archon reaches a Gitea-compatible instance through two independent layers. They do not replace each other, and an install that wants both has both:
Bundled Gitea adapter (GITEA_* env) |
This plugin | |
|---|---|---|
| Layer | platform adapter — transport | forge plugin — work-item operations |
| Does | an issue or PR comment becomes a conversation and a run; the reply is posted back | checks, pr.files, reviews, labels, the marked work-item comment, qualified merge |
| Configured by | GITEA_URL, GITEA_TOKEN, GITEA_WEBHOOK_SECRET, GITEA_ALLOWED_USERS |
forge.hosts + a token or tea login |
Use the adapter for chat — talking to an agent from an issue. Use this plugin when a workflow needs to decide something about the item: gate on checks, read the diff, answer a review, or merge.
One secret, two paths. Both layers read GITEA_TOKEN. Point the plugin at it so the two
cannot drift into different identities:
forge:
hosts:
forge.example.org:
plugin: forgejo
token_env: GITEA_TOKENWithout token_env the plugin resolves FORGEJO_TOKEN, CODEBERG_TOKEN, or GITEA_TOKEN
from ARCHON_HOME/.env, then falls back to your tea login for that host.
A self-hosted instance on a LAN is often plain http and often has a port, and neither is
visible to a plugin that receives a host name. The plugin reads the hosts it must reach over
http from ARCHON_FORGE_PLAIN_HTTP_HOSTS (comma-separated, port included), which Archon sets
from forge.hosts.<host>.scheme: http:
forge:
hosts:
nas.example:3864:
plugin: forgejo
scheme: http
token_env: FORGEJO_TOKENArchon releases before that field exists do not set the variable, so an http-only host cannot
be reached through them. Ports are part of the host name everywhere — nas.example:3864, not
nas.example.
Forgejo differs from GitHub in ways a workflow can trip over:
workitem.closerecords its reason with a label. Forgejo stores no reason for a close: its issue edit carriesstateand nothing else.not_plannedisclosed/not_plannedandduplicateisclosed/duplicate, and an issue carrying neither reads ascompleted, as one closed by hand does. Create both withrepo.label.ensurebefore the first close of that reason; a close whose label is missing is refused rather than recorded as something the labels do not say. The label is written before the close, so a retry after an interrupted close only closes, and a close never rewrites an earlier reason: already closed as another reason is aconflict, and so is an open issue still carrying another reason's label.pr.thread.replyanswers the review of the thread's newest comment. Forgejo has no thread object: a thread is the comments on one line of one file, and a reply joins one review. This plugin groups a thread across reviews, because two reviews commenting on one line are one conversation to a reader, so the reply joins the newest review to stay beside the comments it answers.pr.merge-statereportscleanorunknown, neverconflict. Forgejo reports a pull request as not mergeable while it is still computing the merge, and for a draft or a closed one too, so onlytruejustifiesclean. OnlyPOST /mergecan say a pull request conflicts — a 405 thatpr.mergesurfaces — and a read should not spend it.unknownis what a merge queue re-reads;conflictis what sends a lane to rebase.pr.thread.resolveis not served. Forgejo's API has no way to resolve a review conversation; only its web pages do.- An empty list arrives as
null. Forgejo serializes a nil slice asnull, so an issue with no assignee answers"assignees": null, not[]. Both readings are the empty list here. workitem.openedfilters on when the issue was created, not when it was updated. Forgejo narrows onsinceby updated time — a superset of what was created in the window — so the listing is filtered again oncreated_at, and pull requests are dropped: an observing source starts work on issues only.workitem.label.addedreads the timeline's own event. The event id tells two adds of the same label apart, so a remove and re-add is a new add even when the label is on the item both times it is read. A timeline that records no add answersnullrather than guessing.actor.selfnames the account a token acts as, which is what an assignment is addressed to when the workflow does not know whose credential it runs under.
@archon/forge and the @archon/paths surface it needs are workspace packages inside Archon
and are not published to npm. They are copied into vendor/ from one pinned commit,
recorded in archon-contract.json, and the copy is generated:
bun run vendor # re-derive vendor/ from the pin
bun run vendor:check # fail when the committed copy no longer matches it
bun install
bun run type-check # type-check src against the vendored contract
bun run test # the suite, no Archon checkout needed
bun run build # one executable per platform, into dist/
bun run build:checksums # the same, plus dist/checksums.txtvendor/VENDORED.md names the tag, commit and protocol, what the copy
leaves out, and how to move the pin. Editing vendor/ by hand fails vendor:check, which is
the point: the alternative — hand-maintained protocol schemas — cannot be checked against the
contract at all, and a hand-edited copy would drift from it invisibly.
The pin is Archon fdc50f6b2, which carries the whole version-1 contract including the reads an
install without webhooks uses (workitem.opened, workitem.label.added, actor.self) and the
writes an assignment or a close needs (workitem.assignee.add, workitem.assignee.remove,
pr.close). Every operation the protocol declares is answered; pr.thread.resolve answers
unsupported_op because Forgejo's API has no endpoint behind it.
- No webhook intake or chat replies: that is the adapter's job (see above).
- No API origin discovery from a web URL beyond what the contract's
resolverequires. - Nothing is logged to stdout: it is the protocol channel.
MIT. The plugin protocol and its schemas belong to Archon, also MIT.