gitea-actions

Reusable Gitea Actions for CI workflows.

Actions

nix-setup

Installs Nix and sets up Nix store caching for Gitea Actions workflows.

Features:

  • Uses DeterminateSystems/nix-installer-action for reliable Nix installation
  • Caches /nix/store, /nix/var/nix, and ~/.cache/nix
  • Cache key based on flake.lock hash for automatic invalidation
  • Each repo gets isolated cache (different flake.lock = different cache)

Usage:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: https://git.johnogle.info/johno/gitea-actions/nix-setup@v1
      - run: nix flake check

Note: Full URL required for Gitea Actions to reference actions from the same instance (short-form defaults to GitHub).

Versioning:

This repo uses semantic versioning. Reference actions by:

  • @v1 - Major version (recommended, auto-updates to latest v1.x.x)
  • @v1.0.0 - Specific version (pinned, no auto-updates)
  • @main - Latest development (not recommended for production)

pr-soak

Posts a soak / <N>h commit status on a Renovate PR (or all open Renovate PRs, on a schedule) that stays pending until the PR's head commit has been stable (unrebased) for >= N hours, then flips to success. This is a registry-agnostic stability buffer that pairs with Renovate automerge for fast-releasing deps (e.g. renovate/renovate ships new -full tags daily, so a release-age clock never elapses under the default every-6h run — the soak gates on the PR's own head-commit age instead, which a Renovate rebase resets).

Centralizing this here means the soak logic lives once for every repo (k3s-cluster-config, renovate-container, …) instead of being copied per repo.

This action only posts the status — it does not merge. The caller repo is responsible for making soak / <N>h a required status check on its base branch via Gitea branch protection (a non-required pending status is ignored — that is the failure mode where Renovate merged within the hour) and for setting Renovate automerge: true + automergeType: "pr" on the dep(s) it wants soak-gated.

Author handling: PRs by pr-author (default renovate-bot) soak the full N hours (pending -> success). PRs by any other author (humans, ash-bot infra PRs) are not soak-gated — the action posts an immediate soak / <N>h success for them, so the required check is satisfiable and an admin/write user (e.g. ash-bot) can self-merge infra PRs. (Gitea's API merge does not honor the branch-protection bypass allowlist for a missing required check, so the old "skip non-renovate-bot PRs" behavior left infra PRs un-mergeable via the API — only an owner UI merge could land them.)

Usage — drop this workflow into the consuming repo (e.g. .gitea/workflows/pr-soak.yml), then require soak / 72h on its base branch:

name: PR Soak Check

on:
  pull_request:
    types: [opened, synchronize, reopened]
  schedule:
    - cron: '0 * * * *'   # top of every hour, UTC — flip aged PRs to success
  workflow_dispatch: {}

jobs:
  soak:
    runs-on: ci-light
    steps:
      - uses: https://git.johnogle.info/johno/gitea-actions/pr-soak@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          soak-hours: '72'
          event-name: ${{ github.event_name }}
          pr-number: ${{ github.event.pull_request.number }}
          pr-user: ${{ github.event.pull_request.user.login }}
          pr-sha: ${{ github.event.pull_request.head.sha }}
          server-url: ${{ github.server_url }}
          repository: ${{ github.repository }}
          run-id: ${{ github.run_id }}

Inputs:

Input Description Required Default
token Gitea API token with repo:status + pull read (${{ secrets.GITHUB_TOKEN }}) Yes —
soak-hours Hours the head commit must be stable before pending -> success No 72
pr-author Only soak PRs authored by this user No renovate-bot
event-name Workflow event name (${{ github.event_name }}); pull_request soaks just that PR, else enumerates open PRs by pr-author No ``
pr-number PR number (${{ github.event.pull_request.number }}); pull_request path only No ``
pr-user PR author login (${{ github.event.pull_request.user.login }}); pull_request path only No ``
pr-sha PR head sha (${{ github.event.pull_request.head.sha }}); pull_request path only No ``
server-url Gitea base URL without trailing slash (${{ github.server_url }}) No ``
repository Full repo id owner/name (${{ github.repository }}) No ``
run-id Workflow run id (${{ github.run_id }}) for the status target_url No ``

docker-login-push

Logs in to the private registry and pushes already-tagged local images, retrying each push with exponential backoff. Use this instead of hand-rolling docker login + docker push steps — large-image push flakes get fixed in one place for every repo.

How it pushes (default): instead of docker push-ing to the public host (registry.johnogle.info, reached via Klipper ServiceLB → Traefik TLS ingress → home WAN, which 504s on several-hundred-MB layer uploads), the action copies each image from the job's docker daemon to the registry's in-cluster Service (docker-registry.default.svc.cluster.local:5000) using skopeo copy inside a pinned quay.io/skopeo/stable:v1.19.0 container with the docker socket mounted. The in-cluster Service stores images by repository path, so pushing to <svc>/renovate:<tag> lands in the same renovate repository the cluster pulls as registry.johnogle.info/renovate:<tag> — hostRules/HelmRelease stay unchanged. The action re-targets the host of each ref to the in-cluster Service while preserving the repo path + tag (multi-component paths like registry.johnogle.info/foo/bar:tag are handled). This generalizes the fix first landed in renovate-container PR #6.

Fallback: if use-in-cluster-registry is true (default) but the in-cluster Service DNS name does not resolve — e.g. the job runs on an external runner like ubuntu-latest with no route to the cluster's kube-dns — the action automatically falls back to the external docker push path (with the same retry loop). Set use-in-cluster-registry: false to force the external path. The docker login to the public host always runs (it validates credentials and public-host reachability cheaply, and is required by the external fallback path); the in-cluster skopeo path authenticates via --dest-creds instead.

Usage:

- uses: https://git.johnogle.info/johno/gitea-actions/docker-login-push@v1
  with:
    username: ${{ secrets.REGISTRY_USERNAME }}
    password: ${{ secrets.REGISTRY_PASSWORD }}
    images: |
      registry.johnogle.info/my-image:${{ steps.meta.outputs.tag }}
      registry.johnogle.info/my-image:latest

Build/tag the image first however you like (nix, docker build, buildx); this action only handles login + push.

Inputs:

Input Description Required Default
registry Public registry host (used in image refs and for docker login) No registry.johnogle.info
username Registry username (secrets.REGISTRY_USERNAME) Yes —
password Registry password (secrets.REGISTRY_PASSWORD) Yes —
images Newline-separated fully-qualified image refs to push (multi-component repo paths supported) Yes —
retries Max attempts per image No 5
retry-delay Initial delay (s) between attempts; doubles each attempt No 10
use-in-cluster-registry Push via in-cluster registry Service with skopeo (auto-fallback to external docker push if the Service DNS does not resolve) No true
in-cluster-registry In-cluster registry Service host:port used when use-in-cluster-registry is true No docker-registry.default.svc.cluster.local:5000
skopeo-image Pinned skopeo container image for the in-cluster push No quay.io/skopeo/stable:v1.19.0

With custom cache prefix:

- uses: https://git.johnogle.info/johno/gitea-actions/nix-setup@v1
  with:
    cache-name: 'my-project-'

Inputs:

Input Description Required Default
cache-name Optional cache name prefix for disambiguation No ''
S
Description
Reusable Gitea Actions for CI workflows
Readme
552 KiB
0 Stars 1 Watchers 1 Forks
Languages
Python 91.1%
Nix 8.9%