Clean branch names in symlinking

This commit is contained in:
Severin 2024-04-14 20:28:12 +02:00
parent 8103e51451
commit dc351c02ef

View file

@ -133,19 +133,22 @@ jobs:
run: | run: |
GLOBIGNORE=".:.." GLOBIGNORE=".:.."
# -i leads to a prompt in case of conflict, => a timeout # -i leads to a prompt in case of conflict, => a timeout
if [ -d final/$PRIMARY_BRANCH ]; then if [ -d final/"$PRIMARY_BRANCH" ]; then
cp -irv final/$PRIMARY_BRANCH/* final/ cp -irv final/"$PRIMARY_BRANCH"/* final/
fi fi
ls -a final/ ls -a final/
- name: Symlink branch aliases - name: Symlink branch aliases
run: | run: |
echo $BRANCH_ALIASES | tr ' ' '\n' | grep -E '\S' | echo "$BRANCH_ALIASES" | tr ' ' '\n' | grep -E '\S' |
while IFS=':' read -r key value; do while IFS=':' read -r key value; do
# If the target branch is to be deployed, make symlink to it. # If the target branch is to be deployed, make symlink to it.
if [ "$BRANCHES_TO_DEPLOY" == "*" ] || echo $BRANCHES_TO_DEPLOY | tr ' ' '\n' | grep "^$value$"; then if [ "$BRANCHES_TO_DEPLOY" == "*" ] || echo "$BRANCHES_TO_DEPLOY" | tr ' ' '\n' | grep "^$value$"; then
echo link $key "->" $value # Clean branch names of special characters
ln -s $value final/$key clean_key=$(echo "$key" | tr '/":<>|*?\/\\' '-')
clean_value=$(echo "$key" | tr '/":<>|*?\/\\' '-')
echo link $clean_key "->" $clean_value
ln -s "$clean_value" final/"$clean_key"
fi fi
done done
@ -163,4 +166,3 @@ permissions:
contents: read contents: read
pages: write pages: write
id-token: write id-token: write