fix: missing git author

This commit is contained in:
Julian Tölle 2024-08-05 23:57:28 +02:00
parent 7585dcc858
commit edf09585d8
2 changed files with 14 additions and 1 deletions

View file

@ -278,7 +278,10 @@ func reconcileReleasePR(ctx context.Context, forge rp.Forge, changesets []rp.Cha
}
releaseCommitMessage := fmt.Sprintf("chore(%s): release %s", flagBranch, nextVersion)
releaseCommitHash, err := worktree.Commit(releaseCommitMessage, &git.CommitOptions{})
releaseCommitHash, err := worktree.Commit(releaseCommitMessage, &git.CommitOptions{
Author: rp.GitSignature(),
Committer: rp.GitSignature(),
})
if err != nil {
return fmt.Errorf("failed to commit changes: %w", err)
}

10
git.go
View file

@ -4,9 +4,11 @@ import (
"context"
"fmt"
"os"
"time"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/transport"
)
@ -46,3 +48,11 @@ func CloneRepo(ctx context.Context, cloneURL, branch string, auth transport.Auth
return repo, nil
}
func GitSignature() *object.Signature {
return &object.Signature{
Name: "releaser-pleaser",
Email: "",
When: time.Now(),
}
}