diff --git a/scripts/delete.sh b/scripts/delete.sh index eeb26f89f..4be949dc9 100755 --- a/scripts/delete.sh +++ b/scripts/delete.sh @@ -1,4 +1,4 @@ -#/bin/bash +#!/bin/bash set -e @@ -12,7 +12,7 @@ set -e # # Usage: # export RUNNER_CFG_PAT= -# ./delete.sh scope name +# ./delete.sh [] # # scope required repo (:owner/:repo) or org (:organization) # name optional defaults to hostname. name to delete @@ -26,17 +26,17 @@ set -e runner_scope=${1} runner_name=${2} -echo "Deleting runner ${runner_name} @ ${runner_scope}" - -function fatal() +function fatal() { echo "error: $1" >&2 exit 1 } if [ -z "${runner_scope}" ]; then fatal "supply scope as argument 1"; fi -if [ -z "${runner_name}" ]; then fatal "supply name as argument 2"; fi if [ -z "${RUNNER_CFG_PAT}" ]; then fatal "RUNNER_CFG_PAT must be set before calling"; fi +if [ -z "${runner_name}" ]; then runner_name=`hostname`; fi + +echo "Deleting runner ${runner_name} @ ${runner_scope}" which curl || fatal "curl required. Please install in PATH with apt-get, brew, etc" which jq || fatal "jq required. Please install in PATH with apt-get, brew, etc"