GiteaForge
Defined in: src/forge/gitea.ts:63
Gitea/Forgejo forge driven through the /api/v1 REST API (API-compatible).
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GiteaForge(
slug,cfg,fetchFn?):GiteaForge
Defined in: src/forge/gitea.ts:69
Parameters
Section titled “Parameters”string
fetchFn?
Section titled “fetchFn?”typeof fetch = fetch
Returns
Section titled “Returns”GiteaForge
Properties
Section titled “Properties”deployWorkflow
Section titled “deployWorkflow”
readonlydeployWorkflow:string|null
Defined in: src/forge/gitea.ts:66
Configured deploy workflow filename, or null if redeploy is unavailable.
Implementation of
Section titled “Implementation of”
readonlykind:"gitea"
Defined in: src/forge/gitea.ts:64
Implementation of
Section titled “Implementation of”mergeMethod
Section titled “mergeMethod”
readonlymergeMethod:MergeMethod
Defined in: src/forge/gitea.ts:65
Default merge method for this host (from config; “squash” if unset).
Implementation of
Section titled “Implementation of”
readonlyslug:string
Defined in: src/forge/gitea.ts:70
Implementation of
Section titled “Implementation of”Accessors
Section titled “Accessors”webUrl
Section titled “webUrl”Get Signature
Section titled “Get Signature”get webUrl():
string|null
Defined in: src/forge/gitea.ts:79
Repo’s web home page (e.g. https://github.com/owner/repo); null when unbuildable; absent → null.
Returns
Section titled “Returns”string | null
Repo’s web home page (e.g. https://github.com/owner/repo); null when unbuildable; absent → null.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”addIssueLabel()
Section titled “addIssueLabel()”addIssueLabel(
issueNumber,label):Promise<void>
Defined in: src/forge/gitea.ts:476
Stamp a label on an issue, creating it on the host if absent (best-effort; the
drain claims a backlog issue with ACTIVE_LABEL when it spawns, so a second
shepherd instance skips it). Optional: hosts without a label API omit it and
claims degrade to single-instance local dedup.
Parameters
Section titled “Parameters”issueNumber
Section titled “issueNumber”number
string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”canPush()
Section titled “canPush()”canPush():
Promise<boolean>
Defined in: src/forge/gitea.ts:347
Whether the authenticated user can push. Returns a DEFINITIVE boolean only; THROWS on a probe failure (request error / missing permissions field) so the caller can treat that as retryable rather than silently as “no access”.
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”closeIssue()
Section titled “closeIssue()”closeIssue(
issueNumber):Promise<void>
Defined in: src/forge/gitea.ts:435
Close an issue by number (best-effort; used by the drain to retire a backlog issue once its auto PR merges). Optional: hosts without an issues-close API omit it.
Parameters
Section titled “Parameters”issueNumber
Section titled “issueNumber”number
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”commentIssue()
Section titled “commentIssue()”commentIssue(
issueNumber,body):Promise<void>
Defined in: src/forge/gitea.ts:441
Post a plain comment on an issue (the issue-log’s workflow protocol: one note when the session’s PR enters the waiting-on-handoff state, one when it merges). Best-effort; optional (hosts without an issue-comment API omit it and the issue-log stays silent).
Parameters
Section titled “Parameters”issueNumber
Section titled “issueNumber”number
string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”convertToDraft()
Section titled “convertToDraft()”convertToDraft(
prNumber):Promise<void>
Defined in: src/forge/gitea.ts:410
Convert an open ready PR back to draft (gh pr ready <n> --undo). Optional,
same host gating as markReady.
Parameters
Section titled “Parameters”prNumber
Section titled “prNumber”number
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”createIssue()
Section titled “createIssue()”createIssue(
o):Promise<{number:number;url:string; }>
Defined in: src/forge/gitea.ts:420
Open a new issue (capture-extension delivery path). Returns the created issue’s number + URL. Optional: hosts without an issue-create API omit it and POST /api/issues 400s.
Parameters
Section titled “Parameters”string
string
Returns
Section titled “Returns”Promise<{ number: number; url: string; }>
Implementation of
Section titled “Implementation of”currentUser()
Section titled “currentUser()”currentUser():
Promise<string|null>
Defined in: src/forge/gitea.ts:168
The authenticated Gitea login (GET /api/v1/user), cached for the forge’s
lifetime — it never changes mid-session. Drives the “mine & unassigned” issue
filter (#824) so the chip is live on Gitea too, not just GitHub. Null when it
can’t be resolved (no token / network error) → fail open (show all).
Returns
Section titled “Returns”Promise<string | null>
Implementation of
Section titled “Implementation of”defaultBranch()
Section titled “defaultBranch()”defaultBranch():
Promise<string>
Defined in: src/forge/gitea.ts:334
The repo’s default branch (GET /api/v1/repos/{slug}), cached for the
forge’s lifetime — it never changes mid-session, and listPullRequests polls
this. Cached ONLY on success: a transient failure rethrows so the next call
retries rather than sticking. Mirrors GithubForge.defaultBranch.
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”ensureIssueLink()
Section titled “ensureIssueLink()”ensureIssueLink(
prNumber,issueNumber):Promise<void>
Defined in: src/forge/gitea.ts:445
Ensure the PR body links the issue so the forge auto-closes it on merge.
Idempotent: appends a Closes #<issueNumber> line only when no closing
keyword for that issue is already present. Best-effort; optional (hosts
without a PR-body edit API omit it).
Parameters
Section titled “Parameters”prNumber
Section titled “prNumber”number
issueNumber
Section titled “issueNumber”number
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”getIssue()
Section titled “getIssue()”getIssue(
issueNumber):Promise<Issue|null>
Defined in: src/forge/gitea.ts:133
Fetch ONE issue fresh (UNCACHED) by number, for the drain’s pre-spawn claim
re-check. The cached listIssues view a candidate is selected from can be up to
issuesTtlMs stale, so a second instance may still see an issue another instance
stamped ACTIVE_LABEL on seconds ago. A fresh single-issue read closes that
stale-cache window: if it already carries the claim, the spawn is yielded. Returns
null when the issue is gone/unreadable. Best-effort and optional — hosts without it
(or a transient failure → null) fall back to the cached candidate set + local dedup.
Parameters
Section titled “Parameters”issueNumber
Section titled “issueNumber”number
Returns
Section titled “Returns”Promise<Issue | null>
Implementation of
Section titled “Implementation of”listIssues()
Section titled “listIssues()”listIssues():
Promise<Issue[]>
Defined in: src/forge/gitea.ts:101
Returns
Section titled “Returns”Promise<Issue[]>
Implementation of
Section titled “Implementation of”listPullRequests()
Section titled “listPullRequests()”listPullRequests():
Promise<PullRequest[]>
Defined in: src/forge/gitea.ts:222
Open PRs for the backlog PRs tab (newest first), capped server-side.
Returns
Section titled “Returns”Promise<PullRequest[]>
Implementation of
Section titled “Implementation of”listWorkflowRuns()
Section titled “listWorkflowRuns()”listWorkflowRuns():
Promise<WorkflowRun[]>
Defined in: src/forge/gitea.ts:274
Latest run per workflow on the repo, for the backlog Actions tab. Reads the
actions/tasks endpoint — the only Actions API portable across Forgejo +
Gitea ≥1.23. Despite its name it lists runs, not jobs: there is no per-job
breakdown (so every jobs is empty) and no conclusion field — status is a
single native enum (mapped by mapGiteaActionStatus). We don’t trust the
server’s ordering: sort newest-first, then keep the latest run per workflow
(keyed on the displayed name, so the consumer’s keyed list stays unique).
Returns
Section titled “Returns”Promise<WorkflowRun[]>
Implementation of
Section titled “Implementation of”markReady()
Section titled “markReady()”markReady(
prNumber):Promise<void>
Defined in: src/forge/gitea.ts:402
Flip an open draft PR to ready-for-review (gh pr ready <n>). Optional: only
hosts with a draft API implement it; the draft-reconcile service treats absence
as “cannot promote on this host”.
Parameters
Section titled “Parameters”prNumber
Section titled “prNumber”number
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”merge()
Section titled “merge()”merge(
prNumber,o):Promise<void>
Defined in: src/forge/gitea.ts:428
Parameters
Section titled “Parameters”prNumber
Section titled “prNumber”number
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”openPr()
Section titled “openPr()”openPr(
o):Promise<PrStatus>
Defined in: src/forge/gitea.ts:376
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<PrStatus>
Implementation of
Section titled “Implementation of”postReview()
Section titled “postReview()”postReview(
prNumber,o):Promise<{url?:string; }>
Defined in: src/forge/gitea.ts:513
Post a critic review (request-changes / comment) on a PR. Returns the review’s URL when the host provides one.
Parameters
Section titled “Parameters”prNumber
Section titled “prNumber”number
Returns
Section titled “Returns”Promise<{ url?: string; }>
Implementation of
Section titled “Implementation of”prStatus()
Section titled “prStatus()”prStatus(
headBranch):Promise<PrStatus>
Defined in: src/forge/gitea.ts:318
Parameters
Section titled “Parameters”headBranch
Section titled “headBranch”string
Returns
Section titled “Returns”Promise<PrStatus>
Implementation of
Section titled “Implementation of”redeploy()
Section titled “redeploy()”redeploy(
o):Promise<void>
Defined in: src/forge/gitea.ts:505
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”removeIssueLabel()
Section titled “removeIssueLabel()”removeIssueLabel(
issueNumber,label):Promise<void>
Defined in: src/forge/gitea.ts:499
Remove a label from an issue (best-effort; releases the drain’s claim when an auto session is abandoned, returning the issue to the pool). Optional.
Parameters
Section titled “Parameters”issueNumber
Section titled “issueNumber”number
string
Returns
Section titled “Returns”Promise<void>