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.
This commit is contained in:
Julian Tölle 2025-06-09 11:15:08 +02:00
parent 81a855f5ab
commit 2f781ec994

View file

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