googleapis / release-please

generate release PRs based on the conventionalcommits.org spec
https://www.conventionalcommits.org
Apache License 2.0
4.62k stars 349 forks source link

separate-pull-requests + node-workspace plugin issues #1858

Closed monholm closed 3 weeks ago

monholm commented 1 year ago

While trying to use release-please with separate-pull-requests and the node-workspace plugin enabled, I stumbled upon a couple of issues and some odd behaviour.

When pushing a commit for a single (and at this point in the repro, the only) package, in addition to the chore(main): release <package-name> x.y.z pr, release-please opens another pr (chore: release main) with 0 files changed. The chore: release main pr is open constantly and contains 0 files changed.

Is this expected behaviour? If so, how is one supposed to treat this PR? Leave it as is, merge it before or after the pr containing actual changes, or? I was unable to find any documentation regarding this, so I'm guessing this might be a bug? :)

Moving on from there, using the same setup, if one updates a package that's referenced in another package, the chore: release main pr is updated with the patch bump change for the package that references the updated package. But the changelog change is invalid and if one tries to merge the PR, no tag is created for the patch bump, causing the versioning to fail. I've created a repro, as this is quite difficult describing... 😅

Environment details

Steps to reproduce

  1. Setup basic manifest-based project
  2. Enable separate-pull-request and node-workspace plugin
  3. Add single package and push commit to trigger first release
  4. Observe two PR's being opened, one of which is empty
  5. Add another package and make it depend on the first package.
  6. Update the first package and observe the invalid changelog added to the previously empty PR
  7. If the PR mentioned in step 6 is merged, no tag is created for the bumped package

Again, I've created a repro that hopefully makes it easier to grasp. If not, let me know if I can help provide any other info :)

lorentzfb commented 1 year ago

I have the same issues

shinebayar-g commented 1 year ago

Having an exact same issue. release-please is creating additional empty PR besides the actual package PR.

image

Also there is no autorelease: tag attached to the PR.

release-please-config.json

{
  "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
  "bootstrap-sha": "942d93a2423b28394b427eabdae1b2cc7a174742",
  "bump-minor-pre-major": true,
  "bump-patch-for-minor-pre-major": false,
  "include-v-in-tag": true,
  "separate-pull-requests": true,
  "sequential-calls": true,
  "packages": {
    ".github": {
      "package-name": "workflows",
      "release-type": "simple"
    },
    "packages/my-package": {
      "package-name": "my-package",
      "release-type": "node"
    }
  },
  "plugins": ["node-workspace"],
  "changelog-sections": [
    { "type": "feat", "section": "Features", "hidden": false },
    { "type": "fix", "section": "Bug Fixes", "hidden": false },
    { "type": "chore", "section": "Miscellaneous", "hidden": false },
    { "type": "deps", "section": "Dependencies", "hidden": false },
    { "type": "docs", "section": "Documentation", "hidden": false },
    { "type": "ci", "section": "Continuous Integration", "hidden": false }
  ]
}

.release-please-manifest.json

{
  ".github": "2.3.1",
  ".github+FILLER": "0.0.0",
  "packages/my-package": "2.3.0",
  "packages/my-package+FILLER": "0.0.0"
}
Badisi commented 4 months ago

Also facing the exact same issue.

Sad to see that it was reported a year ago and still hasn't been fixed 😕..

Badisi commented 4 months ago

I was able to track down the issue to the merge plugin (used when enabling the node-workspace plugin).

@chingor13, I don't really understand the purpose of the code here, so I will let you decide what needs to be fixed. Thanks 😊


Trace

From manifest.ts#buildPullRequests() the node-workspace plugin is called: https://github.com/googleapis/release-please/blob/08331fa555ed482f675fb3e9dd5b0a5296e200a3/src/manifest.ts#L798-L801

The node-workspace plugin inherits from WorkspacePlugin but does not overrides the run() method.

So workspace.ts#run() is called instead, and there, the merge plugin is called: https://github.com/googleapis/release-please/blob/08331fa555ed482f675fb3e9dd5b0a5296e200a3/src/plugins/workspace.ts#L169-L177

Here, the merge.ts#run() will always return a PR for the root project merged with the candidates: https://github.com/googleapis/release-please/blob/08331fa555ed482f675fb3e9dd5b0a5296e200a3/src/plugins/merge.ts#L129-L138

Resulting, for a mono-repo, to always have an empty chore: release main even though there is no project at the root.

marjorg commented 3 weeks ago

@chingor13 I might be wrong, but this does not seem to be resolved. The referenced PR above is not merged and has been inactive for ~two months. Has this been resolved elsewhere?