GitBucket
GitBucket
Spoken by GitHubProvider, pointed at your host with a baseURL. Same resources, same shapes, its own quirks kept inside.
Access
CreatecreateProvider("github", { baseURL })
Importimport { GitHubProvider } from"@agntn/forges/github"
EnvGH_TOKEN, GITHUB_TOKEN
CLInone, pass the token
- Header
- Authorization: token
- Anonymous
- depends on the instance
- Threads
- unsupported, REST v3 only
- Code search
- unsupported without the endpoint
- Templates
- repository scope only
Address it
import { createProvider } from "@agntn/forges";
const gitbucket = await createProvider("github", {
token: "…",
baseURL: "https://gitbucket.example.com/api/v3",
});
GitBucket implements the GitHub REST v3 API, so there is no separate provider and I am not writing one. The platform string is github, the host is the baseURL with /api/v3 spelled out. The token chain would ask gh for that host, which is almost never what you want, so pass the token.
What works
Repositories, issues, pull requests, comments, commits and users through the same endpoints the GitHub page lists, as far as your GitBucket version serves them.
What does not
- Review threads. GitBucket is REST v3 only, no GraphQL.
threads.*fails with an explicit unsupported endpoint error rather than a bare 404. - Code search. No
/search/codeendpoint,code.searchfails explicitly. - Releases. GitBucket has no
/releasesAPI, soreleases.*is a 501 with a sentence. - Reactions. No reactions routes either, so
listReactionsis a 501 too. Nobody there reacts, apparently. - Owner templates. A host without the GitHub Enterprise header is repository scope only. The owner's
.githubrepository is not consulted. - GitHub Actions.
ci.listis aNotFoundErrorwhere/actions/runsis missing.
Gotchas
- Pull request checks.
listChecksstill returns the commit statuses when/commits/:sha/check-runsanswers 404. GitHub and Enterprise keep that 404 as not found. - Pagination follows whatever
Linkheader GitBucket emits. When there is none, a list is one page with nonextCursor. - The rate limit headers GitHub sends are usually absent, so a 403 is a
PermissionErrorunless the response carriesRetry-Afteror says rate limit in the body.
Where it lives
src/providers/github.ts, the same class. Anything GitBucket needs is a baseURL away.