File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 })
You can’t perform that action at this time.
0 commit comments