From 780180260c60c35079ba46c5737db6db58d15c8c Mon Sep 17 00:00:00 2001 From: Vistaar Juneja Date: Tue, 31 Oct 2023 16:36:45 +0000 Subject: [PATCH] use pull request ref for pipelines commit ref (#749) --- app/services/trigger/handler_pullreq.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/services/trigger/handler_pullreq.go b/app/services/trigger/handler_pullreq.go index 25e31cb0e..333a09aa7 100644 --- a/app/services/trigger/handler_pullreq.go +++ b/app/services/trigger/handler_pullreq.go @@ -23,8 +23,6 @@ import ( "github.com/harness/gitness/app/pipeline/triggerer" "github.com/harness/gitness/events" "github.com/harness/gitness/types/enum" - - "github.com/drone/go-scm/scm" ) func (s *Service) handleEventPullReqCreated(ctx context.Context, @@ -108,6 +106,6 @@ func (s *Service) augmentPullReqInfo( hook.Target = pullreq.TargetBranch hook.Source = pullreq.SourceBranch // expand the branch to a git reference. - hook.Ref = scm.ExpandRef(pullreq.SourceBranch, "refs/heads") + hook.Ref = fmt.Sprintf("refs/pullreq/%d/head", pullreq.Number) return nil }