Skip to content

Commit 09db2d4

Browse files
committed
Fix tag names
1 parent 6d34ef6 commit 09db2d4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/docker-build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@ jobs:
3434
username: ${{ github.actor }}
3535
password: ${{ secrets.GITHUB_TOKEN }}
3636

37-
- name: Extract branch name
37+
- name: Extract and sanitize branch name
3838
shell: bash
39-
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
39+
run: |
40+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
41+
# Replace forward slashes with hyphens and remove any invalid characters
42+
SANITIZED_BRANCH=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9._-]/-/g' | sed 's/^-//;s/-$//')
43+
echo "BRANCH_NAME=$SANITIZED_BRANCH" >> $GITHUB_ENV
4044
4145
- name: Build and push Docker image
4246
uses: docker/build-push-action@v5

0 commit comments

Comments
 (0)