Skip to content

Commit

Permalink
Merge pull request #12 from vprashar2929/chore-cmt
Browse files Browse the repository at this point in the history
chore: improve readability of script
  • Loading branch information
ocobles authored Aug 26, 2024
2 parents 3237a8b + 88c5234 commit b42e148
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,34 @@ runs:
provisioning_timeout: ${{ inputs.provisioning_timeout }}
user_data: |
#!/bin/bash
set -e # Exit immediately if any command exits with a non-zero status
# Install necessary packages based on OS
if command -v yum &> /dev/null; then
yum install -y curl jq libicu gcc
else
export DEBIAN_FRONTEND=noninteractive
apt-get -qy update
apt-get -qy install build-essential gcc jq
fi
# Create a user for runner
useradd -m ghrunner -s /bin/bash
cd /home/ghrunner
mkdir runner
# Download and install GitHub actions runner
VERSION=$(curl -fsSL https://api.github.com/repos/actions/runner/releases/latest | jq -r .tag_name | sed 's/^v//')
curl -o actions-runner-linux-x64-${VERSION}.tar.gz -fsSL https://github.com/actions/runner/releases/download/v${VERSION}/actions-runner-linux-x64-${VERSION}.tar.gz
tar xzf ./actions-runner-linux-x64-${VERSION}.tar.gz -C runner
chown -R ghrunner ./runner
cd runner
# Configure the runner
sudo -E -u ghrunner ./config.sh --unattended --url https://github.com/${{ steps.get-registration.outputs.runner_scope }} \
--token ${{ steps.get-registration.outputs.registration_token }} --name $(hostname) --work /home/ghrunner \
--labels ${{ steps.get-registration.outputs.runner_scope }} --ephemeral
# Install and start the runner service
./svc.sh install
./svc.sh start

0 comments on commit b42e148

Please sign in to comment.