source "lib/lib.sh" api="$url/api/v1" function main() { local repo repo="root/example-$example" secret="$(openssl rand -hex 20)" runner_name="runner-$(openssl rand -hex 5)" create_offline_registration_token "$runner_name" root "$secret" # Changing to $DIR is necessary so that `.runner` gets created there. Otherwise, `forgejo-runner` would not pick it up. pushd "$DIR" || exit 1 ./forgejo-runner -c "$EXAMPLE_DIR/runner-config.yaml" create-runner-file --instance "http://$IP:3000" --name "$runner_name" --secret "$secret" --connect popd || exit 1 FORGEJO_RUNNER_CONFIG="$EXAMPLE_DIR/runner-config.yaml" forgejo-runner.sh reload label_count=$(jq '.labels | length ' "$DIR/.runner") if [[ "$label_count" != "1" ]] ; then echo "Unexpected number of labels in .runner file: $label_count instead of 1" >&2 exit 1 fi runner_label=$(jq -r '.labels[0]' "$DIR/.runner") if [[ "$runner_label" != "create-runner-file:docker://code.forgejo.org/oci/node:24-trixie" ]] ; then echo "Unexpected runner label: '$runner_label' instead of create-runner-file:docker://code.forgejo.org/oci/node:24-trixie" >&2 exit 1 fi forgejo-test-helper.sh push_workflow "actions/example-$example" "$url" root "example-$example" setup-forgejo "$token" local sha sha="$(forgejo-test-helper.sh branch_tip "$url" "$repo" main)" forgejo-test-helper.sh wait_success "$url" "$repo" "$sha" } main