From 423702f0c0c8eff15cbbd4d1c6fb3d1f18e27423 Mon Sep 17 00:00:00 2001 From: Karan Saraswat Date: Tue, 3 Dec 2024 17:35:07 +0000 Subject: [PATCH] feat: [PIPE-23720]: add author details to the commits API (#3095) * addressed review comment * feat: [PIPE-23720]: add author details to the commits API --- app/api/controller/repo/commit.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/controller/repo/commit.go b/app/api/controller/repo/commit.go index ea7048081..f745c6c14 100644 --- a/app/api/controller/repo/commit.go +++ b/app/api/controller/repo/commit.go @@ -15,6 +15,7 @@ package repo import ( + "cmp" "context" "encoding/base64" "fmt" @@ -57,6 +58,7 @@ type CommitFilesOptions struct { Branch string `json:"branch"` NewBranch string `json:"new_branch"` Actions []CommitFileAction `json:"actions"` + Author *git.Identity `json:"author"` DryRunRules bool `json:"dry_run_rules"` BypassRules bool `json:"bypass_rules"` @@ -166,7 +168,7 @@ func (c *Controller) CommitFiles(ctx context.Context, Actions: actions, Committer: identityFromPrincipal(bootstrap.NewSystemServiceSession().Principal), CommitterDate: &now, - Author: identityFromPrincipal(session.Principal), + Author: cmp.Or(in.Author, identityFromPrincipal(session.Principal)), AuthorDate: &now, }) if err != nil {