mirror of
https://github.com/actions/runner.git
synced 2025-12-10 12:36:23 +00:00
(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>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ set -e
|
|||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# export RUNNER_CFG_PAT=<yourPAT>
|
# export RUNNER_CFG_PAT=<yourPAT>
|
||||||
# ./delete.sh scope name
|
# ./delete.sh <scope> [<name>]
|
||||||
#
|
#
|
||||||
# scope required repo (:owner/:repo) or org (:organization)
|
# scope required repo (:owner/:repo) or org (:organization)
|
||||||
# name optional defaults to hostname. name to delete
|
# name optional defaults to hostname. name to delete
|
||||||
@@ -26,17 +26,17 @@ set -e
|
|||||||
runner_scope=${1}
|
runner_scope=${1}
|
||||||
runner_name=${2}
|
runner_name=${2}
|
||||||
|
|
||||||
echo "Deleting runner ${runner_name} @ ${runner_scope}"
|
function fatal()
|
||||||
|
|
||||||
function fatal()
|
|
||||||
{
|
{
|
||||||
echo "error: $1" >&2
|
echo "error: $1" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "${runner_scope}" ]; then fatal "supply scope as argument 1"; fi
|
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_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 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"
|
which jq || fatal "jq required. Please install in PATH with apt-get, brew, etc"
|
||||||
|
|||||||
Reference in New Issue
Block a user