auto icon indicating copy to clipboard operation
auto copied to clipboard

Release comment and `released` label are added to the PR even when --dry-run flag is passed

Open bugron opened this issue 10 months ago • 0 comments

Describe the bug

When running the auto shipit command with the -d (alias for --dry-run), I noticed that the released label and the released comment are still being added PRs.

The root cause seems to be how the independent lerna versioning is handled in the makeRelease auto hook when the --dry-run flag is passed.

Here is the breakdown of what's going on:

  1. In case of a fixed lerna version (for example,  "version": "11.2.1") the makeRelease hook implicitly returns undefined.
  2. In case of an independent lerna version ("version": "independent") and when the --dry-run flag is passed, the hook returns an empty array.
  3. Release information is retrieved.
  4. In case of a fixed lerna version, the release variable is undefined resulting in not invoking the afterRelease hook, hence no issue in this case.
  5. In case of an independent lerna version and when the --dry-run flag is passed, the release variable is an empty array. This results in invoking the afterRelease hook.
    1. The afterRelease hook is then processed in the released  plugin.
    2. Through the addReleased -> addCommentAndLabel call chain originating from afterRelease hook we end up with a comment on the PR and the released label added to the PR, which is exactly what we observe.

To Reproduce

Run npx auto shipit -d in a repository with independent lerna versioning.

Expected behavior

The released PR comment and label are not added to the PR.

bugron avatar Jan 09 '26 10:01 bugron