use pull request ref for pipelines commit ref (#749)

This commit is contained in:
Vistaar Juneja 2023-10-31 16:36:45 +00:00 committed by Harness
parent f0d87f4437
commit 780180260c

View File

@ -23,8 +23,6 @@ import (
"github.com/harness/gitness/app/pipeline/triggerer" "github.com/harness/gitness/app/pipeline/triggerer"
"github.com/harness/gitness/events" "github.com/harness/gitness/events"
"github.com/harness/gitness/types/enum" "github.com/harness/gitness/types/enum"
"github.com/drone/go-scm/scm"
) )
func (s *Service) handleEventPullReqCreated(ctx context.Context, func (s *Service) handleEventPullReqCreated(ctx context.Context,
@ -108,6 +106,6 @@ func (s *Service) augmentPullReqInfo(
hook.Target = pullreq.TargetBranch hook.Target = pullreq.TargetBranch
hook.Source = pullreq.SourceBranch hook.Source = pullreq.SourceBranch
// expand the branch to a git reference. // 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 return nil
} }