Skip to content

Commit

Permalink
fix: missing git author
Browse files Browse the repository at this point in the history
  • Loading branch information
apricote committed Aug 5, 2024
1 parent 7585dcc commit edf0958
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/rp/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
10 changes: 10 additions & 0 deletions git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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(),
}
}

0 comments on commit edf0958

Please sign in to comment.