Forgejo (Codeberg and self-hosted)
OpsCrew supports repositories hosted on Forgejo — including Codeberg and self-hosted Forgejo instances — through the same safety model as GitHub: every infrastructure change goes through a plan approved by its SHA-256 hash, and no secret is written to your repository, logs, or audit trail.
Prerequisites
Section titled “Prerequisites”- Forgejo version: Forgejo 1.21+ for Actions secrets and variables, and 7.0+ for
triggering workflows through the API (
workflow_dispatch, required byopscrew rollback,opscrew promote, and OpsCrew cloud runs). - Forgejo Actions enabled on the instance and repository, with at least one
forgejo-runnerattached (instance, organization, or repository level). - Personal Access Token (
FORGEJO_TOKEN): create one athttps://<your-forgejo-host>/user/settings/applicationswith:write:repository(files, pull requests, deploy keys, Actions secrets/variables/runs/runners)write:package(container images in Forgejo’s OCI package registry)
Remote detection
Section titled “Remote detection”opscrew init recognises Forgejo automatically when origin points to:
codeberg.orgorcode.forgejo.org;- any hostname with a
forgejoDNS label (for exampleforgejo.company.internal); - any custom hostname configured in
FORGEJO_HOST(or whenOPSCREW_GIT_PLATFORM=forgejo).
export FORGEJO_TOKEN="<your-token>"# Optional for custom domains that do not contain "forgejo":export FORGEJO_HOST="git.example.com"npx opscrew initDeploy workflow & secrets
Section titled “Deploy workflow & secrets”- OpsCrew renders the deploy workflow to
.forgejo/workflows/opscrew-deploy.yml(and.forgejo/workflows/opscrew-deploy-<env>.ymlfor additional environments), based on OpsCrew’s GitHub Actions workflow template. - Registry: images are pushed to your Forgejo instance’s built-in OCI container registry
(
<host>/<owner>/<repo>, orcicd.registryHostwhen overridden). Both build and server-side deploy logins authenticate with${{ secrets.OPSCREW_REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}(prefixed per environment outsideprod); if your instance’s job token cannot access private packages, exportOPSCREW_REGISTRY_TOKENwhen runningopscrew provisionso it is stored alongside the other deploy secrets after approval. - Secrets: Forgejo does not have deployment environments, so OpsCrew stores deploy secrets at
repository scope with per-environment prefixes (
OPSCREW_*for prod,OPSCREW_STAGING_*for staging). runs-onlabels: standard docker-mode jobs requestubuntu-latest; self-hosted OpsCrew server runners (environment.runner: server) requestopscrew-<app>-<env>directly.- Action mirrors: OpsCrew keeps commit-pinned shorthand action references (such as
actions/checkout@<sha>), which respect your Forgejo instance’sDEFAULT_ACTIONS_URL(defaulthttps://data.forgejo.org/).
Live verification checklist
Section titled “Live verification checklist”Unit tests verify Forgejo’s REST v1 API, workflow rendering, and approval-gated provisioning against fake endpoints. Before relying on a new Forgejo instance:
- Run
npx opscrew initwithFORGEJO_TOKENand confirm it signs in against/api/v1/user. - Verify
Settings -> Actions -> SecretsandVariablesare enabled on the repository. - Confirm a
forgejo-runnermatchingubuntu-latest(oropscrew-<app>-<env>:host) is online and can push tohttps://<host>/v2/<owner>/<repo>.