Skip to content

Commit 9f64eb2

Browse files
fix(ci): convert repository name to lowercase for docker tag
The Docker build was failing with the error "repository name must be lowercase" because the GITHUB_REPOSITORY variable contained uppercase characters. This commit fixes the issue by adding a step to the docker.yml workflow that converts the repository name to lowercase before it is used in the image tag for the build-push and trivy-scan jobs.
1 parent dc9d8fb commit 9f64eb2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

.github/workflows/docker.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,23 @@ jobs:
3434
- name: Set up Docker Buildx
3535
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
3636

37+
- name: Lowercase repository name
38+
id: repo_name
39+
run: echo "name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
40+
3741
- name: Build and push
3842
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
3943
with:
4044
context: .
4145
push: true
42-
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
46+
tags: ghcr.io/${{ steps.repo_name.outputs.name }}:${{ github.sha }}
4347
cache-from: type=gha
4448
cache-to: type=gha,mode=max
4549

4650
- name: Scan for vulnerabilities
4751
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
4852
with:
49-
image-ref: 'ghcr.io/${{ github.repository }}:${{ github.sha }}'
53+
image-ref: 'ghcr.io/${{ steps.repo_name.outputs.name }}:${{ github.sha }}'
5054
format: 'table'
5155
exit-code: '1'
5256
ignore-unfixed: true

0 commit comments

Comments
 (0)