From be6ec48344996d9a9c10bc3f51aae1014f6b3bcc Mon Sep 17 00:00:00 2001 From: romain lespinasse Date: Wed, 6 Nov 2019 09:56:13 +0100 Subject: [PATCH] fix: remove leading and trailing `-` caracter --- README.md | 3 ++- entrypoint.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4035027..25493d0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ This action slug and expose some github variables. - put the variable content in lower case, - replace any caracter by `-` except `0-9` and `a-z`, -- limit the string size to 63 caracters +- remove leading and trailing `-` caracter, +- limit the string size to 63 caracters. ## Environement Variables diff --git a/entrypoint.sh b/entrypoint.sh index fa3e84c..2d0d8ac 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,6 +3,7 @@ slug_ref() { echo "$1" \ | tr "[:upper:]" "[:lower:]" \ + | sed -r 's#refs/.*/##;s/[~\^]+//g;s/[^a-zA-Z0-9]+/-/g;s/^-+\|-+$//g;s/^-*//;s/-*$//' \ | cut -c1-63 }