Skip to content

Commit 188e5e0

Browse files
[mq] working branch - merge 11bbfaa on top of main at 229781c
{"baseBranch":"main","baseCommit":"229781cf96178ca0f70ea6cc06bb754bad509635","createdAt":"2025-07-30T08:22:16.909173Z","headSha":"11bbfaa677a1c852bbe495d9156da4ab49e032a2","id":"87692311-10cc-4b8b-bdc2-e52d1173a60b","priority":"200","pullRequestNumber":"3816","queuedAt":"2025-07-30T08:38:09.556085Z","status":"STATUS_QUEUED"}
2 parents 35a3616 + 11bbfaa commit 188e5e0

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

internal/civisibility/constants/git.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ const (
7777
// GitPrBaseCommit indicates the GIT PR base commit hash.
7878
GitPrBaseCommit = "git.pull_request.base_branch_sha"
7979

80+
// GitPrBaseHeadCommit indicates the GIT PR base branch head commit hash.
81+
GitPrBaseHeadCommit = "git.pull_request.base_branch_head_sha"
82+
8083
// GitPrBaseBranch indicates the GIT PR base branch name.
8184
GitPrBaseBranch = "git.pull_request.base_branch"
8285

internal/civisibility/utils/ci_providers.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ func extractGithubActions() map[string]string {
464464
eventDecoder := json.NewDecoder(eventFile)
465465
if eventDecoder.Decode(&eventJSON) == nil {
466466
tags[constants.GitHeadCommit] = eventJSON.PullRequest.Head.Sha
467-
tags[constants.GitPrBaseCommit] = eventJSON.PullRequest.Base.Sha
467+
tags[constants.GitPrBaseHeadCommit] = eventJSON.PullRequest.Base.Sha
468468
tags[constants.GitPrBaseBranch] = eventJSON.PullRequest.Base.Ref
469469
tags[constants.PrNumber] = fmt.Sprintf("%d", eventJSON.Number)
470470
}
@@ -516,7 +516,8 @@ func extractGitlab() map[string]string {
516516
}
517517

518518
tags[constants.GitHeadCommit] = os.Getenv("CI_MERGE_REQUEST_SOURCE_BRANCH_SHA")
519-
tags[constants.GitPrBaseCommit] = os.Getenv("CI_MERGE_REQUEST_TARGET_BRANCH_SHA")
519+
tags[constants.GitPrBaseHeadCommit] = os.Getenv("CI_MERGE_REQUEST_TARGET_BRANCH_SHA")
520+
tags[constants.GitPrBaseCommit] = os.Getenv("CI_MERGE_REQUEST_DIFF_BASE_SHA")
520521
tags[constants.GitPrBaseBranch] = os.Getenv("CI_MERGE_REQUEST_TARGET_BRANCH_NAME")
521522
tags[constants.PrNumber] = os.Getenv("CI_MERGE_REQUEST_IID")
522523

internal/civisibility/utils/ci_providers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func TestGitHubEventFile(t *testing.T) {
164164
expectedPrNumber := "1"
165165

166166
checkValue(tags, constants.GitHeadCommit, expectedHeadCommit)
167-
checkValue(tags, constants.GitPrBaseCommit, expectedBaseCommit)
167+
checkValue(tags, constants.GitPrBaseHeadCommit, expectedBaseCommit)
168168
checkValue(tags, constants.GitPrBaseBranch, expectedBaseRef)
169169
checkValue(tags, constants.PrNumber, expectedPrNumber)
170170
})

0 commit comments

Comments
 (0)