feat: [PIPE-23720]: add author details to the commits API (#3095)

* addressed review comment
* feat: [PIPE-23720]: add author details to the commits API
pull/3597/head
Karan Saraswat 2024-12-03 17:35:07 +00:00 committed by Harness
parent 18da27f968
commit 423702f0c0
1 changed files with 3 additions and 1 deletions

View File

@ -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 {