Skip to content

Commit

Permalink
Merge pull request #14 from vprashar2929/custom-u-data
Browse files Browse the repository at this point in the history
feat: Add support for executing custom user data
  • Loading branch information
displague authored Oct 2, 2024
2 parents b42e148 + 49df56d commit 6cc6009
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

0 comments on commit 6cc6009

Please sign in to comment.