- JavaScript 85.6%
- Shell 14.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| code/scan | ||
| go | ||
| image | ||
| jvm | ||
| lib | ||
| mise/setup | ||
| node/setup | ||
| python/lint | ||
| rails | ||
| test | ||
| trivista/upload | ||
| trivy/cache | ||
| workflow-templates | ||
| yaml/lint | ||
| .editorconfig | ||
| .yamllint.yaml | ||
| README.md | ||
| renovate.json | ||
ci/actions
Shared composite actions for Forgejo Actions on git.metawave.ch. Each action is the harmonized best variant of what the former Woodpecker pipelines did per repository. Public because Forgejo runners only fetch actions from public repositories; contains no secrets, callers pass them as inputs.
Building blocks
| Action | Purpose | Job image |
|---|---|---|
image/build |
Build via docker/build-push-action (per-job builder, nothing left on the runner) with registry layer cache; on the default branch push main-<unix-ts>-<sha8> + latest (or explicit tags), then image/scan with SBOM; elsewhere dry run. Optional platforms (cross-compile; no QEMU set up) and Docker Hub mirror |
ubuntu-latest (docker CLI) |
image/scan |
Trivy image scan → log summary → Trivista; optional CycloneDX SBOM as run artifact sbom-<name>-<tag> (expires with the artifact retention) |
any |
code/scan |
Trivy filesystem scan (offline) → log summary → Trivista → fail on CRITICAL | any, after checkout |
trivy/cache |
Restore the daily Trivy vulnerability + Java DB cache into .trivy-cache. Used by code/scan and image/scan |
any |
trivista/upload |
Upload a Trivy JSON report, log the scan link | any |
jvm/setup |
JDK from mise.toml via mise (GitHub releases, no Adoptium API) + Maven/Gradle cache (Gradle key also hashes gradle.properties, libs.versions.toml and gradle-wrapper.properties) |
any |
jvm/qodana |
Checkout + Qodana Community for JVM with cached Maven/Gradle dependencies (the cache is saved even when the analysis fails); the report (qodana.sarif.json + HTML report/) is attached to the run as artifact qodana-report (also when the analysis fails; input retention-days, default 14). The HTML report needs an HTTP server (python3 -m http.server in report/), index.html does not work from file:// |
any |
node/setup |
Node.js from mise.toml via mise + npm cache (keyed on package-lock.json) |
any |
rails/setup |
Ruby from .ruby-version/.tool-versions/mise.toml (prebuilt) + cached bundle without production, libvips if needed; replaces per-repo CI images |
ubuntu-latest |
rails/ci |
The app's bin/ci (Rails 8.1: steps in config/ci.rb, the same checks as locally); Google Chrome when it runs system tests (checksum from Google's apt index, cached by version and architecture), their failure screenshots as artifact |
ubuntu-latest |
rails/audit |
Nightly dependency audit: bundler-audit, any advisory fails (bin/bundler-audit with config/bundler-audit.yml if present) + importmap audit |
ubuntu-latest |
yaml/lint |
yamllint with the repository's .yamllint* config; optional path (default .) |
ubuntu-latest (pipx) |
python/lint |
ruff check + ruff format --check (config from ruff.toml/pyproject.toml); optional path (default .) |
any, after checkout |
go/setup |
Go from mise.toml via mise + module/build cache |
any |
mise/setup |
Pinned mise release + tools from mise.toml (install_args). Used by jvm/setup, node/setup and go/setup |
any |
go/lint |
golangci-lint (config from .golangci.yml, else defaults) |
any, after checkout |
go/vulncheck |
go/setup + govulncheck; fails only on vulnerabilities the code reaches |
ubuntu-latest |
Reference them with the full URL (short owner/repo refs resolve against data.forgejo.org):
- uses: https://git.metawave.ch/ci/actions/code/scan@main
with:
trivista-token: ${{ secrets.TRIVISTA_TOKEN }}
Expected org secrets: REGISTRY_USERNAME, REGISTRY_PASSWORD, TRIVISTA_TOKEN; for the Docker Hub mirror also
DOCKERHUB_TOKEN plus the org variable DOCKERHUB_USERNAME (vars.): a secret's value is masked in every log,
and a username equal to the org name would turn every path into ***. Repositories owned by a user (e.g. toubi)
see no org secrets and only the owner can push to their packages: they use user-level secrets/variables of that user
(REGISTRY_USERNAME = the user as variable, REGISTRY_PASSWORD = a write:package token of the user,
TRIVISTA_TOKEN), set by a site admin via the API with the Sudo: <user> header.
Conventions
- Layout:
<area>/<action>/action.yml, shared shell/JS helpers inlib/. - Composite actions, not reusable workflows: inside reusable workflows Forgejo 17.0 / runner v13 still
reports
event_nameasworkflow_call(required soon.workflow_call.inputswork; see Forgejo #10614, since v15). That hides the original trigger (push,schedule, …) and breaks trigger detection in these actions (e.g.trivista/upload). Callers keep thin workflows (triggers +uses:). - Logging (
lib/log.sh): every step logs what it does (==>; not▶, which Forgejo draws in front of collapsible groups), the relevant parameters and why (e.g. why a push is skipped), the outcome (✔/✘, digests, finding counts, scan links). Verbose tool output goes into collapsible::group::blocks. Skips are never silent (↷with the reason). Secrets are named, never printed. - Names: every workflow, step and matrix job gets a
name:. Without one Forgejo shows theuses:ref (actions/checkout@<sha>) or the first command, a scheduled run is titled with the file path, and a matrix job lists every matrix value. Forgejo interpolates${{ }}in job names, not in step names. - Triggers:
pushon every branch, nopull_request. Forgejo runs a pull request on its head commit, the same one the push already tested, so every Renovate update ran twice; the push run's commit status shows on the PR anyway. - Default branch comes from the event payload, so
mainandmasterrepositories both work. - Pinning: third-party actions by short ref and commit SHA (
owner/repo@<sha> # vX.Y.Z); the runner resolves them against data.forgejo.org. Images by digest. Renovate keeps them current (helpers:pinGitHubActionDigests, withforgejo-tagson data.forgejo.org soforgejo/upload-artifactis found too) and waitsminimumReleaseAge: 3 daysbefore proposing a release, except for vulnerability alerts. Tags are mutable — see the trivy-action tag hijack of 2026-03-19 (CVE-2026-33634). An action that is not mirrored on data.forgejo.org is silently skipped; those (jdx/mise-action,ruby/setup-ruby) use the full GitHub URL. Our own building blocks reference each other by@main. Tool versions outsideuses:carry a# renovate: datasource=… depName=…comment on the line above. - Versioning:
@mainuntil all repositories are migrated, thenv1tags. - Validate (
.forgejo/workflows/validate.yaml):forgejo-runner validateagainst the action, workflow and template schema (the templates are validated one by one,--directorydoes not look intoworkflow-templates/), yamllint, shellcheck of everyrun:block (actions, workflows and templates), a fixture test oflib/trivy-summary.js, and smoke tests ofyaml/lintandpython/lintagainsttest/fixtures(a passing and a failing case each).
Pitfalls (learned the hard way)
- Short action refs resolve against data.forgejo.org. An action that is not mirrored there is silently
skipped (the job continues). Use the full URL (
https://github.com/owner/action@sha) for anything else. GITHUB_TOKENis Forgejo's job token. Actions that send it to github.com (mise-action, setup-trivy) must get an empty token (github_token: '',GITHUB_TOKEN: ''in the step env).- mise-action exports
mise.toml[env]by default, overriding the workflow's env with local development values (reeeder:DB_URL=localhost). The setup actions passenv: false;jvm/setupsetsJAVA_HOMEitself. - The runner image ships third-party apt repos (packages.microsoft.com, PPAs) that can stall
apt-get updatefor minutes; install from the Ubuntu archive only and setDEBIAN_FRONTEND=noninteractive. - No shared tool caches between parallel jobs: setup-ruby reinstalls Bundler into its Ruby on every run. Prefer installers that do not need remote version APIs (mise for JDKs instead of the Adoptium API).
- Forgejo's registry races on concurrent uploads of the same new blob (unique constraint on
package_blob, then a nil-pointer panic → 500). buildx pushes image and cache in parallel, soimage/buildexports the cache in a second, sequential step. - Schedule events carry no repository:
forgejo.event.repository.default_branchis empty, so a check likeforgejo.ref == format('refs/heads/{0}', forgejo.event.repository.default_branch)is false on every scheduled run (Renovate ran dry for a day). Compare against the branch name instead (forgejo.ref == 'refs/heads/main')./actions/runsdoes not list scheduled runs either;/actions/tasksdoes. ${{is evaluated anywhere inrun:, even in a shell comment or a sed pattern; an unparsable one makes the whole workflow unusable ("YAML Schema validation error"). Write[$]{{where the characters are meant literally.- Runner restarts kill running jobs (they show as running until Forgejo's zombie timeout); roll out runner config changes when no jobs run.
Workflow templates
workflow-templates/ holds the standard structure of a consumer workflow, one file per archetype. Copy the file that
fits to .forgejo/workflows/ of the repository and adjust the TODO lines. (The folder is called
workflow-templates so Renovate's github-actions manager finds the actions/checkout pin in it by default.)
| Template | Archetype | Used by (today) |
|---|---|---|
ci-image.yaml |
Dockerfile only: image/build |
caddy, healthchecks, homepage, typingmind, kube-build-tools, mdb (with python/lint), sandstrand, web |
ci-jvm.yaml |
Maven/Gradle: jvm/qodana, jvm/setup, tests, image/build |
tickets, covid19, reeeder (backend), zeiterfassung-tools, trackz (backend, Jib instead of image/build) |
ci-node.yaml |
Node.js frontend: node/setup, npm checks, image/build |
reeeder (frontend), trackz (frontend) |
ci-go.yaml |
Go: go/lint, go/setup + tests, image/build |
http-logger-proxy |
ci-rails.yaml |
Rails: rails/ci (bin/ci), image/build; without bin/ci: rails/setup + bundle exec rake |
meinfest, sarah-und-marcel, sharebox, tiradelza, covid-checkin, TaskPort, tidyup, forgejo-registry-cleanup |
security.yaml |
nightly code/scan + image/scan |
every repository with an image |
security-rails.yaml |
the same plus rails/audit |
the Rails repositories |
What every template sets, and why:
concurrencywith group${{ forgejo.workflow }}-${{ forgejo.ref }}andcancel-in-progress: ${{ forgejo.ref != 'refs/heads/main' && forgejo.ref != 'refs/heads/master' }}: a newer push to a feature or Renovate branch cancels the older run of the same workflow, the default branch is never cancelled (an image push or a nightly scan runs to the end). Both default-branch names are listed because the expression must not depend on the event payload (default_branchis empty on scheduled runs). Workflows of the same repository do not cancel each other: the workflow name is part of the group.timeout-minutesper job, so a hanging step does not block the runner for hours: 10 for lint, scans and audits (they take 1 to 3 minutes), 15 for the Node build, 20 for Qodana, Rails checks, JVM build and image builds (up to 8 minutes today, the first run without a cache takes longer). A job that really needs more raises its own value.actions/checkout@<sha> # vX.Y.Zin the short form (see Pinning), our own actions ashttps://git.metawave.ch/ci/actions/…@main.- Triggers:
pushandworkflow_dispatch; the security workflow adds the nightlyscheduleand limitspushto the files that change a scan result.
Renovate in a consumer repository needs no configuration for the checkout pin: the github-actions manager reads
.forgejo/workflows/*.yaml. A shared preset (pin digests, minimumReleaseAge) would only be worth it to carry the
settings of this repository's renovate.json over to the consumers.
A Go repository adds the vulnerability check to its security workflow:
vulncheck:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@<sha> # vX.Y.Z
- name: Check vulnerabilities (govulncheck)
uses: https://git.metawave.ch/ci/actions/go/vulncheck@main
Migrating a repository from Woodpecker
- Enable Actions on the repository (
has_actions); it was disabled on many repositories. Remove leftover repository secrets from the 2025 Actions setup (REGISTRY_*,DOCKERHUB_*, ...): repository secrets shadow the org secrets of the same name. - Add
.forgejo/workflows/ci.yaml(start fromworkflow-templates/; checks → build; Rails apps:rails/cirunsbin/ci, plain Ruby:bundle exec rake) andsecurity.yaml(audit, code scan, nightly image scan) withenable-email-notifications: true; remove.woodpecker/,Dockerfile.ciand leftover.github/workflows(Forgejo runs those when.forgejo/workflowsis missing). - Test on a branch (builds are dry runs there), then merge to the default branch.
- Deactivate the repository in Woodpecker (
woodpecker-cli repo rm <repo>deactivates, history is kept). - Delete the packages Woodpecker left behind: the CI image
<repo>-ci(built fromDockerfile.ci) and generic<repo>-sbompackages; the SBOM is now an artifact of the run.
Canary
.forgejo/workflows/canary.yaml runs every night at 02:00 UTC (03:00 Europe/Zurich in winter, 04:00 during
daylight time) and can be started by hand (workflow_dispatch). It reuses the validate checks via
workflow_call and additionally exercises node/setup, jvm/setup, go/setup and go/lint against
test/fixtures, so a stale pin or a broken upstream tool shows up before a consumer build fails. code/scan
is included only when TRIVISTA_TOKEN is present, because the action requires it for the Trivista upload.
Scheduled workflows run from the default branch only. A failed or recovered scheduled run emails the
contact address of the ci organization (set in the org settings).