feat: add params

This commit is contained in:
2025-09-24 11:49:07 +08:00
parent 29a90ef7bc
commit 008a5d92a7
2 changed files with 11 additions and 3 deletions

View File

@@ -9,7 +9,14 @@ on:
runner_id:
required: true
type: string
spec:
required: false
type: string
default: "s-1vcpu-1gb"
image:
required: false
type: string
default: "200895606" # Ubuntu 22.04 x64
secrets:
DO_TOKEN:
required: true
@@ -40,6 +47,7 @@ jobs:
id: provisioning
env:
SPEC: ${{ inputs.spec }}
IMAGE: ${{ inputs.image }}
RUNNER_ID: ${{ inputs.runner_id }}
DO_TOKEN: ${{ secrets.DO_TOKEN }}
SSH_PRIVATE_KEY_DECODED: ${{ secrets.SSH_PRIVATE_KEY_DECODED }}

View File

@@ -250,7 +250,7 @@ setup_vm() {
}
# Check required environment variables
check_env_vars "SPEC" "RUNNER_ID" "DO_TOKEN" "SSH_PRIVATE_KEY_DECODED" "DROPLET_NAME" "DROPLET_SIZE" "DROPLET_IMAGE" "DROPLET_REGION"
check_env_vars "SPEC" "IMAGE" "RUNNER_ID" "DO_TOKEN" "SSH_PRIVATE_KEY_DECODED"
# Check if doctl is available
check_doctl
@@ -258,7 +258,7 @@ check_doctl
# Setup SSH private key
setup_ssh_key
create_droplet "$DROPLET_NAME" "$DROPLET_SIZE" "$DROPLET_IMAGE" "$DROPLET_REGION"
create_droplet "$RUNNER_ID" "$SPEC" "$IMAGE"
# Calculate and display execution time
END_TIME=$(date +%s)