mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 13:21:00 +00:00
feat: real user as commit author (#187)
Previously all commits were authored and committed by
releaser-pleaser <>
This looked weird when looking at the commit. We now check with the
Forge API for details on the currently authenticated user, and use that
name and email as the commit author. The commit committer stays the same
for now.
In GitHub, the default `$GITHUB_TOKEN` does not allow access to the
required endpoint, so for github the user `github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>` is hardcoded
when the request fails.
This commit is contained in:
parent
f2786c8f39
commit
175d6d0633
6 changed files with 121 additions and 13 deletions
|
|
@ -255,13 +255,18 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
|
|||
}
|
||||
}
|
||||
|
||||
releaseCommitAuthor, err := rp.forge.CommitAuthor(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get commit author: %w", err)
|
||||
}
|
||||
|
||||
releaseCommitMessage := fmt.Sprintf("chore(%s): release %s", rp.targetBranch, nextVersion)
|
||||
releaseCommit, err := repo.Commit(ctx, releaseCommitMessage)
|
||||
releaseCommit, err := repo.Commit(ctx, releaseCommitMessage, releaseCommitAuthor)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to commit changes: %w", err)
|
||||
}
|
||||
|
||||
logger.InfoContext(ctx, "created release commit", "commit.hash", releaseCommit.Hash, "commit.message", releaseCommit.Message)
|
||||
logger.InfoContext(ctx, "created release commit", "commit.hash", releaseCommit.Hash, "commit.message", releaseCommit.Message, "commit.author", releaseCommitAuthor)
|
||||
|
||||
// Check if anything changed in comparison to the remote branch (if exists)
|
||||
newReleasePRChanges, err := repo.HasChangesWithRemote(ctx, rpBranch)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue