Skip to content

Commit 27d1a4b

Browse files
tonyxiaoclaude
andcommitted
fix(ci): sanitize Docker tag — replace / with - in ref name
github.ref_name is "172/merge" for PRs, which is invalid in Docker tags. Use bash substitution ${GITHUB_REF_NAME//\//-} to produce a valid tag. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Committed-By-Agent: claude
1 parent e113c57 commit 27d1a4b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,20 @@ jobs:
5353

5454
- name: Build Docker image
5555
run: |
56+
TAG="${GITHUB_REF_NAME//\//-}"
5657
docker build \
5758
--build-arg GIT_COMMIT=${{ github.sha }} \
5859
--build-arg BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
5960
--build-arg COMMIT_URL=${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} \
6061
-t ghcr.io/${{ github.repository }}:${{ github.sha }} \
61-
-t ghcr.io/${{ github.repository }}:${{ github.ref_name }} \
62+
-t ghcr.io/${{ github.repository }}:${TAG} \
6263
.
6364
6465
- name: Push Docker image
6566
run: |
67+
TAG="${GITHUB_REF_NAME//\//-}"
6668
docker push ghcr.io/${{ github.repository }}:${{ github.sha }}
67-
docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }}
69+
docker push ghcr.io/${{ github.repository }}:${TAG}
6870
6971
- name: Docker smoke test
7072
run: docker run --rm ghcr.io/${{ github.repository }}:${{ github.sha }} --version

0 commit comments

Comments
 (0)