We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d34ef6 commit 09db2d4Copy full SHA for 09db2d4
.github/workflows/docker-build.yml
@@ -34,9 +34,13 @@ jobs:
34
username: ${{ github.actor }}
35
password: ${{ secrets.GITHUB_TOKEN }}
36
37
- - name: Extract branch name
+ - name: Extract and sanitize branch name
38
shell: bash
39
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
+ 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
44
45
- name: Build and push Docker image
46
uses: docker/build-push-action@v5
0 commit comments