Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package release fails for main default branch #1794

Open
davidduffett opened this issue Feb 17, 2025 · 3 comments
Open

Package release fails for main default branch #1794

davidduffett opened this issue Feb 17, 2025 · 3 comments

Comments

@davidduffett
Copy link

The skuba release command fails for private npm packages where the repository has a main (not master) default branch.

This is due to the semantic-release version being out of date, as support for main branch was added in v23.1.0.

Error message below.

[2:44:04 AM] [semantic-release] › ✘  An error occurred while running semantic-release: TypeError: Cannot read properties of undefined (reading 'name')
    at getFailComment (file:///workdir/node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@semantic-relea
se/github/lib/get-fail-comment.js:20:12)
    at fail (file:///workdir/node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@semantic-release/github/
lib/fail.js:45:9)
    at async fail (file:///workdir/node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@semantic-release/g
ithub/index.js:104:3)
    at async validator (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/lib/plugins/normalize.js:36:2
4)
    at async file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/lib/plugins/pipeline.js:38:36
    at async file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/lib/plugins/pipeline.js:32:5
    at async pluginsConfigAccumulator.<computed> [as fail] (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-r
elease/lib/plugins/index.js:87:11)
    at async callFail (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/index.js:249:7)
    at async Module.default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/index.js:279:7)
    at async default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/cli.js:55:5) {
  pluginName: '@semantic-release/github'
}
[2:44:04 AM] [semantic-release] › ✘  ERELEASEBRANCHES The release branches are invalid in the `branches` configuration.
A minimum of 1 and a maximum of 3 release branches are required in the branches configuration (https://github.com/semantic-release/semantic-release/blob/master/
docs/usage/configuration.md#branches).
This may occur if your repository does not have a release branch, such as master.
Your configuration for the problematic branches is [].
AggregateError:
    SemanticReleaseError: The release branches are invalid in the `branches` configuration.
        at default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/lib/get-error.js:6:10)
        at file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/lib/branches/index.js:45:19
        at Array.reduce (<anonymous>)
        at default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/lib/branches/index.js:35:46)
        at async run (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/index.js:68:22)
        at async Module.default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/index.js:275:22)
        at async default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/cli.js:55:5)
    at default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/lib/branches/index.js:67:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async run (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/index.js:68:22)
    at async Module.default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/index.js:275:22)
    at async default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/cli.js:55:5) {
  errors: [
    SemanticReleaseError: The release branches are invalid in the `branches` configuration.
        at default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/lib/get-error.js:6:10)
        at file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/lib/branches/index.js:45:19
        at Array.reduce (<anonymous>)
        at default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/lib/branches/index.js:35:46)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async run (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/index.js:68:22)
        at async Module.default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/index.js:275:22)
        at async default (file:///workdir/node_modules/.pnpm/[email protected][email protected]/node_modules/semantic-release/cli.js:55:5) {
      code: 'ERELEASEBRANCHES',
      details: 'A minimum of 1 and a maximum of 3 release branches are required in the [branches configuration](https://github.com/semantic-release/semantic-rel
ease/blob/master/docs/usage/configuration.md#branches).\n' +
        '\n' +
        'This may occur if your repository does not have a release branch, such as `master`.\n' +
        '\n' +
        'Your configuration for the problematic branches is `[]`.',
      semanticRelease: true
    }
  ]
} ELIFECYCLE  Command failed with exit code 1.
🚨 Error: The command exited with status 1
@samchungy
Copy link
Contributor

@davidduffett we've been having some internal discussions about potentially dropping Semantic Release completely in favour of Changesets

@AaronMoat
Copy link
Contributor

Current workaround would be to set the --branches config when running skuba release, and yeah that ☝ as well as not currently being able to upgrade due to an aggressive node version support policy in semantic release 😢

@72636c
Copy link
Member

72636c commented Feb 17, 2025

The current current workaround is to add a .releaserc to the repo root—we template new projects to specify main rather than master here:

"<%- defaultBranch %>",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants