feat: avoid pushing release branch only for rebasing (#114)

Right now releaser-pleaser pushes the branch even if it is only for a "rebase",
this wastes CI resources. Instead, it should only push when there are changes
to the files it owns.

- **Old**: Push when there is a diff origin/release-pr..release-pr
- **New**: Push when the these two diffs are not the same:
  
      origin/main..release-pr
      $(git merge-base origin/main origin/release-pr)..release-pr

Closes #92
This commit is contained in:
Julian Tölle 2025-06-09 10:52:09 +02:00 committed by GitHub
parent 175d6d0633
commit 81a855f5ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 376 additions and 11 deletions

View file

@ -269,7 +269,7 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
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)
newReleasePRChanges, err := repo.HasChangesWithRemote(ctx, rp.targetBranch, rpBranch)
if err != nil {
return err
}