diff --git a/action.yml b/action.yml index 8a44005..f8a6f15 100644 --- a/action.yml +++ b/action.yml @@ -10,7 +10,8 @@ inputs: required: true service_account_key: description: 'Base64 encoded JSON key for GCP service account' - required: true + required: false + default: '' image_name: description: 'Name of container image to be deployed' required: true diff --git a/entrypoint.sh b/entrypoint.sh index 5d9aea5..70ccb77 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,13 +21,13 @@ SERVICE_NAME_LENGTH_LIMIT=62 set -e set -o pipefail - -echo "$INPUT_SERVICE_ACCOUNT_KEY" | base64 -d >key.json -trap "{ rm -f key.json; }" EXIT - -enableDebug -gcloud auth activate-service-account --key-file=key.json --project="$INPUT_PROJECT_ID" -disableDebug +if [ -n "$INPUT_SERVICE_ACCOUNT_KEY" ]; then + echo "$INPUT_SERVICE_ACCOUNT_KEY" | base64 -d >key.json + trap "{ rm -f key.json; }" EXIT + enableDebug + gcloud auth activate-service-account --key-file=key.json --project="$INPUT_PROJECT_ID" + disableDebug +fi IMAGE_TAG="latest" if [ -n "$INPUT_IMAGE_TAG" ]; then diff --git a/tests/run.bats b/tests/run.bats index 9d3a534..a00662c 100755 --- a/tests/run.bats +++ b/tests/run.bats @@ -51,7 +51,6 @@ function debug() { debug "${status}" "${output}" "${lines}" - echo $output | grep -q "Could not read json file key.json" [[ "${status}" -eq 1 ]] }