# Sources for this configuration:
# - https://forgejo.org/docs/latest/admin/actions/
# - https://forgejo.org/docs/latest/user/actions/
# - https://docs.gitea.com/next/usage/actions/act-runner

{ config, pkgs, ... }:

{
  services.gitea-actions-runner = {
    package = pkgs.forgejo-actions-runner;
    instances.ccchh-forgejo-global-docker = {
      enable = true;
      name = "Global Docker Forgejo Actions Runner";
      url = "https://git.hamburg.ccc.de/";
      tokenFile = "/run/secrets/forgejo_actions_runner_registration_token";
      labels = [ "docker:docker://node:current-bookworm" ];
    };
  };

  sops.secrets."forgejo_actions_runner_registration_token" = {
    mode = "0440";
    owner = "root";
    group = "root";
    restartUnits = [ "gitea-runner-ccchh\\x2dforgejo\\x2dglobal\\x2ddocker.service" ];
  };
}