From 2f781ec994a534d56ed5a40ca3f634d1da94404c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Mon, 9 Jun 2025 11:15:08 +0200 Subject: [PATCH] fix: crash when running in repo without any tags Recent changes in v0.5.1 introduced a bug that caused releaser-pleaser to crash when running in a repository that contained no tags at all. This fixes the issue by checking if there is a tag before using it in the logger. Bug was introduced in #174. --- releaserpleaser.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/releaserpleaser.go b/releaserpleaser.go index 3c316ae..409d8bb 100644 --- a/releaserpleaser.go +++ b/releaserpleaser.go @@ -327,7 +327,11 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error { } func (rp *ReleaserPleaser) analyzedCommitsSince(ctx context.Context, since *git.Tag) ([]commitparser.AnalyzedCommit, error) { - logger := rp.logger.With("method", "analyzedCommitsSince", "tag.hash", since.Hash, "tag.name", since.Name) + logger := rp.logger.With("method", "analyzedCommitsSince") + + if since != nil { + logger = rp.logger.With("tag.hash", since.Hash, "tag.name", since.Name) + } commits, err := rp.forge.CommitsSince(ctx, since) if err != nil {