diff --git a/action.yml b/action.yml index 46de1c9..3a26b67 100644 --- a/action.yml +++ b/action.yml @@ -28,6 +28,9 @@ inputs: repository_level: description: "Set to true to enable repository level registration token" default: "false" + custom_script: + description: "Custom user script to run (as root) before starting the runner" + default: "" runs: using: "composite" steps: @@ -91,6 +94,17 @@ runs: --token ${{ steps.get-registration.outputs.registration_token }} --name $(hostname) --work /home/ghrunner \ --labels ${{ steps.get-registration.outputs.runner_scope }} --ephemeral + # Running custom script if provided + if [[ -n "${{ inputs.custom_script }}" ]]; then + CUSTOM_SCRIPT=$(mktemp $HOME/custom_script.XXXXXX.sh) + cat > $CUSTOM_SCRIPT <<'CUSTOM_SCRIPT_EOF' + ${{ inputs.custom_script }} + CUSTOM_SCRIPT_EOF + chmod 0700 $CUSTOM_SCRIPT + echo "Running custom user script" + sudo $CUSTOM_SCRIPT + fi + # Install and start the runner service ./svc.sh install ./svc.sh start