Skip to content

Commit 710db26

Browse files
authored
Merge pull request #89 from SprocketBot/codex/sanitize-ghcr-branch-tags
[codex] Sanitize GHCR image tags for branch names
2 parents f7ad6a2 + d387d8f commit 710db26

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ jobs:
3535
username: ${{ github.actor }}
3636
password: ${{ secrets.GITHUB_TOKEN }}
3737

38-
- name: Extract branch name
38+
- name: Extract image tag
3939
shell: bash
40-
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT"
40+
run: |
41+
raw_ref="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
42+
safe_tag="$(echo "$raw_ref" | tr '[:upper:]' '[:lower:]' | sed 's|[^a-z0-9._-]|-|g')"
43+
echo "branch=$safe_tag" >> "$GITHUB_OUTPUT"
4144
id: extract_branch
4245

4346
- name: Build And Push Image

0 commit comments

Comments
 (0)