#!/bin/sh # mock-act-runner — stands in for `act_runner` of the gitea/act_runner image (PEP-320 test). # The test links it as /act_runner so supervise.sh recognises it by its command line, as the real one. # register --config … --name … → writes a new .runner in the current directory (unique each time) # daemon --config … → runs until SIGTERM (graceful exit, like act_runner), logs to stdout case "$1" in register) printf '{"id":%s,"uuid":"mock-%s-%s","name":"%s"}\n' "$$" "$$" "$(date +%s)" "$*" > .runner echo "mock runner registered successfully" ;; daemon) [ -f .runner ] || { echo "mock: no .runner here" >&2; exit 1; } trap 'echo "mock daemon $$ stopping gracefully"; exit 0' TERM echo "mock daemon $$ declare successfully" while :; do sleep 1 & wait $!; done ;; *) echo "mock-act-runner: unknown command $1" >&2; exit 2 ;; esac