Skip to content

Fix cr upload --pr with --packages-with-index - #682

Open
RaphaelFakhri wants to merge 1 commit into
helm:mainfrom
RaphaelFakhri:fix-upload-pr-packages-with-index
Open

RaphaelFakhri wants to merge 1 commit into
helm:mainfrom
RaphaelFakhri:fix-upload-pr-packages-with-index

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

What this PR does

Since #314 moved the push out of the release loop, cr upload publishes the package commits in the Pages worktree only with --push. With --packages-with-index --pr, the commits are discarded with the temporary worktree and no pull request is created, while the command reports success. With --push but without --packages-with-index, cr upload pushes the HEAD of the current directory to the Pages branch.

This PR:

  • Makes commitPackage report whether it created a commit. Identical replacements with --replace-existing still create no commit.
  • Calls pushToPagesBranch with either --push or --pr, and only when --packages-with-index created a commit. This avoids pushing the current directory and opening a pull request with no changes when every release is skipped.

Fixes #681

Testing

  • New TestReleaser_CreateReleasesPublishesPackages covers --push and --pr, with and without --packages-with-index. Before the fix, the pr-packages-with-index and push-without-packages-with-index cases fail. After the fix, all cases pass.
  • TestReplace* now checks that an identical replacement reports no commit.
  • go vet ./..., go test ./... and golangci-lint run (v2.14) pass.

Since the upload worktree was moved out of the release loop, package
commits in the Pages worktree are published only with --push. With --pr,
the commits are discarded with the temporary worktree and no pull request
is created. With --push but without --packages-with-index, cr pushes the
HEAD of the current directory to the Pages branch.

Publish the package commits with either --push or --pr, and only when
--packages-with-index created a commit.

Signed-off-by: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cr upload --pr with --packages-with-index never pushes or opens a pull request

1 participant