Skip to content

Commit b120b8d

Browse files
curusarnclaude
andcommitted
Fix Docker tag generation for pull requests
Use pr-X format for PR builds to avoid invalid Docker tags when branch names contain slashes or special characters. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c9f7814 commit b120b8d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/betterstack-docker.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@ jobs:
5757
type=raw,value=latest,enable={{is_default_branch}}
5858
# For version tags, use the version
5959
type=ref,event=tag
60-
# For branches, use branch name
60+
# For pull requests, use pr-X format
61+
type=ref,event=pr,prefix=pr-
62+
# For branches, use branch name (sanitized)
6163
type=ref,event=branch
62-
# SHA prefix for all builds
63-
type=sha,prefix={{branch}}-,format=short
64+
# SHA prefix - use pr-X for PRs, branch for others
65+
type=sha,prefix=pr-{{pr}}-,format=short,enable=${{ github.event_name == 'pull_request' }}
66+
type=sha,prefix={{branch}}-,format=short,enable=${{ github.event_name != 'pull_request' }}
6467
6568
- name: Build and test
6669
run: |

0 commit comments

Comments
 (0)