Skip to content

Commit fb58f36

Browse files
committed
Sanitize ref name before using it as container tag
1 parent 959183c commit fb58f36

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.github/workflows/build-notebooks-TEMPLATE.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,12 @@ jobs:
113113
114114
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push
115115
- name: "push|schedule: make ${{ inputs.target }}"
116-
run: "make ${{ inputs.target }}"
116+
run: |
117+
SANITIZED_REF_NAME=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9._-]/_/g')
118+
export IMAGE_TAG="${SANITIZED_REF_NAME}_${{ github.sha }}"
119+
make ${{ inputs.target }}
117120
if: ${{ fromJson(inputs.github).event_name == 'push' || fromJson(inputs.github).event_name == 'schedule' }}
118121
env:
119-
IMAGE_TAG: "${{ github.ref_name }}_${{ github.sha }}"
120122
IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images"
121123
CONTAINER_BUILD_CACHE_ARGS: "--cache-from ${{ env.CACHE }} --cache-to ${{ env.CACHE }}"
122124

0 commit comments

Comments
 (0)