mirror of
https://github.com/rlespinasse/github-slug-action.git
synced 2026-06-29 09:41:04 +00:00
fix: remove leading and trailing - caracter
This commit is contained in:
committed by
Romain Lespinasse
parent
93d0a6d6be
commit
be6ec48344
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user