Skip to content

Linked-versions internal merge is misconfigured #1778

@luxaritas

Description

@luxaritas

Environment details

GitHub Actions ubuntu-latest with release-please-action 3.7.1

Steps to reproduce

I've attempted to configure two linked-versions plugins to create two separate groups, like so:

{
  "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
  "plugins": [
    {
      "type": "node-workspace",
      "merge": false
    },
    {
      "type": "linked-versions",
      "groupName": "groupa",
      "components": [
        "groupa",
        "packages-groupa-pkga1",
        "packages-groupa-pkga2"
      ],
      "merge": false
    },
    {
      "type": "linked-versions",
      "groupName": "groupb",
      "components": [
        "groupb",
        "packages-groupb-pkgb1",
        "packages-groupb-pkgb2"
      ],
      "merge": false
    }
  ],
  "packages": {
    "packages/groupa": {
      "component": "groupa",
      "release-type": "simple"
    },
    "packages/groupa/pkga1": {
      "component": "packages-groupa-pkga1",
      "skip-github-release": true
    },
    "packages/groupa/pkga2": {
      "component": "packages-groupa-pkga2",
      "skip-github-release": true
    },
    "packages/groupb": {
      "component": "groupb",
      "release-type": "simple"
    },
    "packages/groupb/pkgb1": {
      "component": "packages-groupb-pkgb1",
      "skip-github-release": true
    },
    "packages/groupb/pkgb2": {
      "component": "packages-groupb-pkgb2",
      "skip-github-release": true
    }
  }
}

However, only the second group makes it to the release PR. It seems like this is due to the following error:

pull request missing version {
  path: '.',
  pullRequest: {
    title: PullRequestTitle {
      version: undefined,
      component: undefined,
      targetBranch: 'main',
      pullRequestTitlePattern: 'chore${scope}: release groupa libraries',
      matchPattern: /^chore(\((?<branch>[\w-./]+)\))?: release groupa libraries$/
    },
    body: PullRequestBody {
      header: ':robot: I have created a release *beep* *boop*',
      footer: 'This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).',
      extra: undefined,
      releaseData: [Array],
      useComponents: true
    },
    updates: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object]
    ],
    labels: [ 'autorelease: pending' ],
    headRefName: 'release-please--branches--main',
    draft: false
  },
  config: { releaseType: 'simple' }
}

Analysis

My understanding of this is that when the first linked-versions plugin does its internal merge, it creates a PR without a version, and then the second linked-version plugin throws out that PR even though it is out of scope. Additionally, this is complicated by the fact that linked-versions does not honor the merge configuration property, as it is never passed when constructed by its plugin factory.

Resolution

I see two potential resolutions here:

  1. Regardless, the plugin should respect "merge": false. I've confirmed that modifying the plugin factory to pass additional options like the workspace plugins do resolves the issue and results in all packages being included in the release
  2. I imagine it would still be nice to allow two linked-versions plugins to coexist and create separate PRs. What is the reason for ensuring a PR version when doing the merge? Can it be only verified for in-scope candidates, or maybe even removed entirely? This check is done in WorkspacePlugin as well, and it isn't clear why.

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions