diff --git a/dist/index.js b/dist/index.js index c213fdae..df23580d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -62814,6 +62814,17 @@ function buildUserDataScript(githubRegistrationToken, label) { `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, './run.sh', ]; + } else if (config.input.runnerUser) { + return [ + '#!/bin/bash', + `cd /home/"${config.input.runnerUser}"`, + `sudo -u "${config.input.runnerUser}" mkdir actions-runner && cd actions-runner`, + 'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}', + `sudo -u "${config.input.runnerUser}" ` + 'curl -O -L https://github.com/actions/runner/releases/download/v2.299.1/actions-runner-linux-${RUNNER_ARCH}-2.299.1.tar.gz', + `sudo -u "${config.input.runnerUser}" ` + 'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.299.1.tar.gz', + `sudo -u "${config.input.runnerUser}" ./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, + `sudo -u "${config.input.runnerUser}" ./run.sh`, + ]; } else { return [ '#!/bin/bash', @@ -62918,6 +62929,7 @@ class Config { ec2InstanceId: core.getInput('ec2-instance-id'), iamRoleName: core.getInput('iam-role-name'), runnerHomeDir: core.getInput('runner-home-dir'), + runnerUser: core.getInput('runner-user'), }; const tags = JSON.parse(core.getInput('aws-resource-tags')); diff --git a/src/aws.js b/src/aws.js index c6bd8c9d..5d935ed0 100644 --- a/src/aws.js +++ b/src/aws.js @@ -14,6 +14,17 @@ function buildUserDataScript(githubRegistrationToken, label) { `./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, './run.sh', ]; + } else if (config.input.runnerUser) { + return [ + '#!/bin/bash', + `cd /home/"${config.input.runnerUser}"`, + `sudo -u "${config.input.runnerUser}" mkdir actions-runner && cd actions-runner`, + 'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}', + `sudo -u "${config.input.runnerUser}" ` + 'curl -O -L https://github.com/actions/runner/releases/download/v2.299.1/actions-runner-linux-${RUNNER_ARCH}-2.299.1.tar.gz', + `sudo -u "${config.input.runnerUser}" ` + 'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.299.1.tar.gz', + `sudo -u "${config.input.runnerUser}" ./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`, + `sudo -u "${config.input.runnerUser}" ./run.sh`, + ]; } else { return [ '#!/bin/bash', diff --git a/src/config.js b/src/config.js index 13bf86a1..900a6f92 100644 --- a/src/config.js +++ b/src/config.js @@ -14,6 +14,7 @@ class Config { ec2InstanceId: core.getInput('ec2-instance-id'), iamRoleName: core.getInput('iam-role-name'), runnerHomeDir: core.getInput('runner-home-dir'), + runnerUser: core.getInput('runner-user'), }; const tags = JSON.parse(core.getInput('aws-resource-tags'));