Skip to content

Commit 78a73c7

Browse files
clubandersonclaude
andcommitted
fix(ci): use PR head SHA instead of merge commit SHA
For pull_request events, checkout and tag images using the PR head SHA (github.event.pull_request.head.sha) instead of the merge commit SHA (github.sha). This ensures the image contains the actual PR changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3fe60dd commit 78a73c7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/ci-e2e-openshift.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ jobs:
5050
steps:
5151
- name: Checkout source
5252
uses: actions/checkout@v4
53+
with:
54+
# Use PR head SHA for pull_request events, otherwise default
55+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
5356

5457
- name: Log in to GHCR
5558
uses: docker/login-action@v3
@@ -63,7 +66,8 @@ jobs:
6366
env:
6467
REGISTRY: ghcr.io
6568
IMAGE_NAME: ${{ github.repository }}
66-
GIT_REF: ${{ github.sha }}
69+
# Use PR head SHA for pull_request events, otherwise github.sha
70+
GIT_REF: ${{ github.event.pull_request.head.sha || github.sha }}
6771
run: |
6872
# Build image with git ref tag for this PR
6973
# Use first 8 chars of the git ref
@@ -99,6 +103,9 @@ jobs:
99103
steps:
100104
- name: Checkout source
101105
uses: actions/checkout@v4
106+
with:
107+
# Use PR head SHA for pull_request events, otherwise default
108+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
102109

103110
- name: Extract Go version from go.mod
104111
run: sed -En 's/^go (.*)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV

0 commit comments

Comments
 (0)