Skip to content

Commit 4520c93

Browse files
Merge pull request #651 from caponetto/sanitize-ref-name
chore(ci): Sanitize ref name before using it as container tag
2 parents 37df13c + fb58f36 commit 4520c93

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
@@ -115,10 +115,12 @@ jobs:
115115
116116
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push
117117
- name: "push|schedule: make ${{ inputs.target }}"
118-
run: "make ${{ inputs.target }}"
118+
run: |
119+
SANITIZED_REF_NAME=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9._-]/_/g')
120+
export IMAGE_TAG="${SANITIZED_REF_NAME}_${{ github.sha }}"
121+
make ${{ inputs.target }}
119122
if: ${{ fromJson(inputs.github).event_name == 'push' || fromJson(inputs.github).event_name == 'schedule' }}
120123
env:
121-
IMAGE_TAG: "${{ github.ref_name }}_${{ github.sha }}"
122124
IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images"
123125
CONTAINER_BUILD_CACHE_ARGS: "--cache-from ${{ env.CACHE }} --cache-to ${{ env.CACHE }}"
124126

0 commit comments

Comments
 (0)