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 }