From 6b8452170ad4be80a74305cbd547879eb5f46d4b Mon Sep 17 00:00:00 2001 From: Nikola Jokic <97525037+nikola-jokic@users.noreply.github.com> Date: Tue, 22 Nov 2022 14:47:22 +0100 Subject: [PATCH] (delete.sh) Loggin repaired and made runner_name optional defaulting to hostname (#1871) * Loggin repaired and made runner_name optional defaulting to hostname * Update scripts/delete.sh Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com> Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- scripts/delete.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/delete.sh b/scripts/delete.sh index eeb26f89f76..4be949dc920 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"