- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| .github | ||
| build-push-sign-images | ||
| cache-grype-db | ||
| cache-maven | ||
| cache-policy | ||
| cache-uv | ||
| docs/images | ||
| forge-checkout | ||
| gitops-bump-pr | ||
| LICENSES | ||
| mirror-repo | ||
| next-version | ||
| repo-hygiene | ||
| setup-nix-flake-auth | ||
| .gitignore | ||
| CODE_OF_CONDUCT.md | ||
| CODEOWNERS | ||
| CONTRIBUTING.md | ||
| LICENSE.md | ||
| README.md | ||
| REUSE.toml | ||
| SECURITY.md | ||
HOIST IT - Forgejo actions
First-party composite actions shared across HOIST IT repositories.
Reference an action by its full URL and subpath, pinned to a tag:
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
Actions
Dependency caches
Use cache-uv, cache-maven or cache-grype-db before the corresponding
install, test or scan. Call the same action with phase: save after the job's
checks succeed. Both calls use the same working-directory and dependency
selection. A save call is required to populate the cache; there is no automatic
post-job upload.
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
- run: uv sync --frozen
- run: scripts/tasks/test-unit.sh
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
with:
phase: save
| action | payload and compatibility |
|---|---|
cache-uv |
Public PyPI dependency cache, keyed by uv/Python version, platform, lock and local workspace manifests. |
cache-maven |
Artifact/plugin repository, keyed by platform, POMs and flake.lock when present. |
cache-grype-db |
Grype database, keyed by scanner version, platform and UTC day, with compatible older entries as fallback. |
| input | default | description |
|---|---|---|
phase |
restore |
restore before tool use; save after successful checks. |
working-directory |
. |
Checkout or uv workspace root. |
dependency-files |
**/pom.xml |
Maven only: newline-separated POM globs relative to the working directory. Every pattern must match. |
For a clone outside the runner workspace, pass its directory on both calls.
Maven needs no Java installation at cache-restore time: the action sets an
explicit repository through MAVEN_OPTS, independently of Java's user.home.
Existing options retain Maven's launcher syntax. The temporary cache path must
not contain whitespace, which the launcher would split into separate arguments.
It excludes settings.xml and project build directories, and removes failed
download markers so Maven can retry them. Maven still resolves dependencies
online and runs the tests.
Keys distinguish repositories and PR namespaces because the deployed runner's cleanup groups entries by key/version. Restores include exact trusted and compatible fallbacks; the backend controls priority between namespaces. An exact trusted match suppresses a duplicate PR upload. Authorization remains with the backend.
The uv action supports lock-controlled uv sync workflows. It removes local
workspace packages and packages whose lock source is outside public PyPI,
then prunes dangling entries before upload. Those packages are also cleared
after restore, so source/version changes cannot reuse an old local build.
Private-package credentials must remain available to normal installation.
Do not use this cache directory for unrelated uvx or unlocked installs.
Grype updates and database-age validation stay enabled even on exact hits. Always run the scanner; its validation and severity failures remain failures. The action does not cache a scan verdict or disable freshness checks to make an offline run pass.
Runtime and trust boundary
The job needs Python 3.11 or newer, its tool (uv or grype where relevant),
a Node-capable Actions runtime and GNU tar with gzip. Use consistent zstd
availability across producers and consumers. Toolbox CI images provide these
prerequisites; the runner administrator must separately enable a reachable
Forgejo cache service. No additional cache PAT is needed.
Each working directory gets a dedicated cache child of RUNNER_TEMP, so one
project cannot upload another project's unsanitized dependencies. Tool commands
must use the workspace whose cache was most recently activated. The payload
excludes the whole home directory, .venv, credential files and test/report outputs. An
invalid configuration or a failed sanitization stops the action. A missing
or unavailable cache service falls back to normal tool execution.
Default-branch push and manual-dispatch runs may upload trusted entries.
On forge.hoist-it.nl, PR runs may also save into the backend's PR-local
namespace. This deployment is verified against runner v12.13.2: other PRs and
trusted runs cannot read those writes. Other servers keep PR uploads disabled
until their isolation contract is verified centrally. Non-default push runs
restore only.
Someone who can modify a workflow can bypass its client-side policy. The backend must enforce repository and untrusted-write isolation. PR readers may see trusted entries, so private wheels must stay out of the payload. Key prefixes are not access controls.
Never skip an install, test or scan based on the cache-hit output. Use
artifacts for required data exchange and review evidence. Keep Nix outputs in
a Nix binary cache rather than archiving the store here.
forge-checkout
Blessed checkout for HOIST IT Forgejo repos. Wraps
HOIST-IT-Actions/checkout@v7 with GIT_DEFAULT_HASH set to the repo's object
format and an optional exact-SHA reset (full fetch), replacing the per-repo
checkout@v6/v7 + code.forgejo.org drift and every re-pasted
GIT_DEFAULT_HASH. Most HOIST IT repos are sha256, the default; a sha1 repo
(such as the skills, knowledge and odoo-config repos) passes
object-format: sha1, or the fetch fails with couldn't find remote ref.
| input | default | description |
|---|---|---|
ref |
(triggering ref) | Branch/tag/ref to check out. |
fetch-depth |
1 |
Shallow depth (0 = full). Forced to 0 when sha is set. |
sha |
(none) | Exact commit SHA to reset the worktree to after checkout. |
object-format |
sha256 |
The repo's object format: sha256 or sha1. |
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
with:
sha: ${{ github.sha }}
setup-nix-flake-auth
Authenticate nix's flake fetcher against the private forge so a repo can pull a
private git+forge flake input (for example the toolbox). nix uses libgit2,
which ignores git's url.insteadOf but does consult git's credential helper, so
the token is stored in ~/.git-credentials (never in argv or the locked flake
URL). Pass the token as an input; the caller supplies it from a secret.
| input | default | description |
|---|---|---|
forge-token |
(required) | Forgejo token with read access to the private flake-input repo(s). |
host |
forge.hoist-it.nl |
Forge host the credential is scoped to. |
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
with:
forge-token: ${{ secrets.FORGE_TOKEN }}
next-version
Compute the next semver from the conventional-commit history with commitizen
(read-only, no bump/commit/tag). Outputs version and release; release is
false when there are no releasable commits since the last tag, gating the
build/publish/tag jobs into a no-op. Needs uvx on PATH and a full-depth
checkout with tags.
| input | default | description |
|---|---|---|
commitizen-spec |
commitizen>=4.16 |
pip requirement spec for commitizen. |
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
id: ver
- run: echo "release=${{ steps.ver.outputs.release }} version=${{ steps.ver.outputs.version }}"
repo-hygiene
Server-side hygiene gate: actionlint over workflow files plus gitleaks over
selected Git history. It provisions the tools and Python from pinned nixpkgs
and needs nix on the job. Check out full history, including both PR endpoints.
| input | default | description |
|---|---|---|
actionlint-config |
.github/actionlint.yaml |
actionlint ignore-list; skipped if absent. |
gitleaks-args |
detect --source . --verbose --redact |
Git-mode arguments, parsed as words without shell expansion. |
gitleaks-revisions |
HEAD |
Checked-out commit ancestry, or full base-SHA..head-SHA (SHA-1 or SHA-256). |
nixpkgs |
(pinned rev) | nixpkgs providing actionlint, gitleaks and Python. |
Pass the PR's own base..head range explicitly. The action does not infer an
event: reusable Forgejo workflows may not receive the caller's event fields.
Resolve them in the caller and forward them as inputs. Missing endpoints or
unavailable revisions refuse with exit 2 rather than falling back to all refs.
For a push to main, keep HEAD: it rescans main's own history, including
removed secrets, but never unrelated fetched branches. A detected secret still
fails with gitleaks' exit status. Directory scans and --no-git refuse because
they do not preserve Git-mode allowlist semantics.
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
with:
fetch-depth: "0"
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
with:
gitleaks-revisions: ${{ github.event_name == 'pull_request' && format('{0}..{1}', github.event.pull_request.base.sha, github.event.pull_request.head.sha) || 'HEAD' }}
Run the real Git/gitleaks regression suite locally with the action's pinned tools. It plants a synthetic credential on an unrelated branch and inside the PR range, then checks isolation, historical detection and refusal paths.
nix --extra-experimental-features 'nix-command flakes' shell \
github:NixOS/nixpkgs/567a49d1913ce81ac6e9582e3553dd90a955875f#gitleaks \
github:NixOS/nixpkgs/567a49d1913ce81ac6e9582e3553dd90a955875f#python3Packages.pytest \
github:NixOS/nixpkgs/567a49d1913ce81ac6e9582e3553dd90a955875f#python3Packages.pyyaml \
--command python3 -m pytest -q
gitops-bump-pr
Open a GitOps deploy PR: clone the gitops repo, bump the newTag of an image in
a kustomization, commit on a branch, push and open a PR. Needs git, curl and jq
on PATH.
| input | default | description |
|---|---|---|
gitops-repo |
(required) | owner/repo of the gitops repository. |
kustomization |
(required) | Path (in the gitops repo) to the kustomization to bump. |
image-tag |
(required) | New tag to set as newTag. |
token |
(required) | Token with write access to the gitops repo. |
host |
forge.hoist-it.nl |
Forge host. |
base |
main |
Base branch to target. |
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
with:
gitops-repo: HOISTIT/gitops
kustomization: apps/staging/website/kustomization.yaml
image-tag: ${{ needs.build.outputs.tag }}
token: ${{ secrets.GITOPS_TOKEN }}
mirror-repo
Mirror the checked-out repo to one or more external remotes, optionally converting a SHA-256 repo to SHA-1 first. Needs a full-depth checkout and a recent git (the nix-ci / node-ci images carry git 2.54).
| input | default | description |
|---|---|---|
dst-urls |
(required) | Destination remote URLs (with creds), space- or newline-separated. |
convert-sha256-to-sha1 |
false |
Convert a SHA-256 source to SHA-1 before mirroring. |
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
with:
dst-urls: ${{ secrets.CLIENT_MIRROR_URL }}
convert-sha256-to-sha1: "true"
build-push-sign-images
Build every nix2container image from a flake, push it daemonlessly (skopeo
copyTo), and cosign-sign plus attest it, under strict runner-disk discipline:
an upfront nix store gc, a gc-rooted signing toolchain, and a per-image
nix store gc when free store space drops below a threshold. Each image builds,
pushes and signs independently (a failure is recorded and the loop continues),
then the run exits non-zero if any image failed (fail-closed). Extracted from
toolbox build-images.yaml so the disk-GC discipline and the fail-closed loop
live in one place. The calling job owns the container, the flake checkout and
the registry/cosign secrets; the action owns the loop and the disk discipline.
Run it on a nix-capable image (nixos-nix / nix-ci) whose NIX_CONFIG enables
nix-command + flakes and sets sandbox = false.
Two modes cover the two flake-app shapes in use across the org:
copyto-sign(default, the toolbox shape): per image name, push via<flake>#<name>.copyTothen sign via<flake>#<sign-app> -- <name>.publish-app(the dp-engine /mkPublishImageshape): per target, run one self-contained build+push+sign app as<flake>#<app> -- <dest-ref>:<tag>.
| input | default | description |
|---|---|---|
mode |
copyto-sign |
copyto-sign or publish-app. |
flake |
. |
Flake ref prefix for nix run/nix eval; sha256 repos pass path:.. |
tag |
latest |
Tag to push. publish-app appends it to each dest-ref; copyto-sign's sign-image pins :latest itself, so keep latest there (see caveats). |
extra-tags |
(none) | copyto-sign: extra tags pushed before tag, for example an immutable per-build tag; every push must yield the same digest (see caveats). |
registry |
forge.hoist-it.nl/hoist-it-infra |
Base registry+namespace for copyto-sign pushes. |
images |
(enumerated) | copyto-sign: explicit names; enumerated from images-expr when empty. |
images-expr |
.#ciImageNames |
copyto-sign: nix expr evaluated to a JSON list of names. |
sign |
true |
copyto-sign: sign each pushed image. |
sign-app |
sign-image |
copyto-sign: the signing flake app (<flake>#<sign-app> -- <name>). |
apps |
(none) | publish-app: newline list of <app> <dest-ref> targets. |
gc-root-app |
(none) | Flake app to gc-root before the loop (toolbox passes sign-image). |
gc-threshold-gib |
15 |
Per-image nix store gc below this many GiB free (0 disables; see caveats). |
store-path |
/nix |
Filesystem whose free space bounds the per-image gc. |
working-directory |
. |
Directory the loop runs in (where the flake lives); consumers cloning into a temp dir point this at it. |
log-groups |
true |
Wrap each phase in a collapsible ::group:: and print a coloured summary; false for flat output. |
Per-image output is wrapped in a collapsible log group and coloured (honours
NO_COLOR): a successful run shows one folded group per image plus a coloured
summary, and a failed target re-prints its full log expanded with an
::error::. Set log-groups: false for flat, ungrouped output.
Registry auth: set REGISTRY_USER + REGISTRY_TOKEN in the job env (the action
passes them as --dest-creds for copyto-sign), or provide REGISTRY_AUTH_FILE
for skopeo. Signing reads the COSIGN_* env the flake apps expect. Set all
of these on the calling job.
Three caveats:
- copyto-sign's
sign-appderives its own reference. The bundledsign-imagesigns<default registry>/<img>:latest, so keeptag: latestand the defaultregistryin copyto-sign mode unless you pass asign-appthat signs the pushed<registry>/<img>:<tag>(a non-latest tag would otherwise sign the old:latestdigest; the action warns when it detects this). - The Forgejo container registry keeps a tag-pushed manifest only under its
tag: re-pushing
:latestdeletes the previous:latestmanifest, so a pin<img>:latest@sha256:<digest>breaks withmanifest unknownafter the next build. Pass an immutable per-build tag inextra-tagsand pin consumers to<img>:<that tag>@sha256:<digest>; the digest then stays resolvable for as long as its tag exists. The action pushes each extra tag beforetagand fails closed unless all pushes produced one digest, so the single signature on that digest covers every tag. - publish-app apps that SHARE an unrooted build-time toolchain across iterations
(dp-engine's two apps reuse a just-built, unrooted skopeo) must set
gc-threshold-gib: "0", so the per-image gc does not reclaim that toolchain and force a recompile that exhausts the runner disk (#34).
toolbox (copyto-sign, clone into /tmp/tb, enumerate the flake image list, gc-root
the shared signer, an immutable build tag next to latest):
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
with:
working-directory: /tmp/tb
gc-root-app: sign-image
extra-tags: ${{ steps.tag.outputs.tag }}
dp-engine (publish-app, two self-contained apps, sha256 repo so path:., shared
skopeo so the mid-loop gc is disabled):
- uses: https://forge.hoist-it.nl/HOIST-IT-Actions/actions/[email protected]
with:
mode: publish-app
flake: "path:."
working-directory: /tmp/src
tag: ${{ needs.bump.outputs.version }}
gc-threshold-gib: "0"
apps: |
release-image ${{ vars.REGISTRY_URL }}/${{ env.IMAGE_NAME }}
runner-release-image ${{ vars.REGISTRY_URL }}/${{ env.RUNNER_IMAGE_NAME }}
