Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ token=
project_id=
service_account_key=
runner_ver=
vm_name_prefix=
machine_zone=
machine_type=
boot_disk_type=
Expand Down Expand Up @@ -49,6 +50,7 @@ while getopts_long :h opt \
project_id required_argument \
service_account_key required_argument \
runner_ver required_argument \
vm_name_prefix required_argument \
machine_zone required_argument \
machine_type required_argument \
boot_disk_type optional_argument \
Expand Down Expand Up @@ -87,6 +89,9 @@ do
runner_ver)
runner_ver=$OPTLARG
;;
vm_name_prefix)
vm_name_prefix=$OPTLARG
;;
machine_zone)
machine_zone=$OPTLARG
;;
Expand Down Expand Up @@ -180,7 +185,7 @@ function start_vm {
jq -r .token)
echo "✅ Successfully got the GitHub Runner registration token"

VM_ID="gce-gh-runner-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
VM_ID="${vm_name_prefix}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
service_account_flag=$([[ -z "${runner_service_account}" ]] || echo "--service-account=${runner_service_account}")
image_project_flag=$([[ -z "${image_project}" ]] || echo "--image-project=${image_project}")
image_flag=$([[ -z "${image}" ]] || echo "--image=${image}")
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ inputs:
description: Version of the GitHub Runner. "latest" will resolve the latest version.
default: "latest"
required: true
vm_name_prefix:
description: Prefix of the name of created VM, final name is ${prefix}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}
default: "gce-gh-runner"
required: true
machine_zone:
description: GCE zone
default: "us-east1-c"
Expand Down Expand Up @@ -120,6 +124,7 @@ runs:
--project_id=${{ inputs.project_id }}
--service_account_key='${{ inputs.service_account_key }}'
--runner_ver=${{ inputs.runner_ver }}
--vm_name_prefix=${{ inputs.vm_name_prefix }}
--machine_zone=${{ inputs.machine_zone }}
--machine_type=${{ inputs.machine_type }}
--network=${{ inputs.network }}
Expand Down