Skip to content

Commit

Permalink
cli: Fix jetpack changelog add on a release branch
Browse files Browse the repository at this point in the history
When running `jetpack changelog add` while on a release branch, the
script should not throw an error about attempting to access `.length` on
`undefined`.
  • Loading branch information
anomiex committed Oct 22, 2024
1 parent 248684d commit a07dd0a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/cli/commands/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ async function changelogAdd( argv ) {
return;
}

let changelogInfo, needChangelog;
let changelogInfo,
needChangelog = [];

if ( argv.project ) {
needChangelog = [ argv.project ];
Expand Down Expand Up @@ -695,7 +696,11 @@ async function checkChangelogFiles() {
const branchReg = /\/branch-/; // match example: jetpack/branch-1.2.3
if ( currentBranch.match( branchReg ) ) {
console.log( chalk.green( 'Release branch detected. No changelog required.' ) );
return [];
return {
touched: [],
files: new Map(),
need: [],
};
}

const re1 = /^projects\/([^/]+\/[^/]+)\//; // regex matches project file path, ie 'project/packages/connection/..'
Expand Down

0 comments on commit a07dd0a

Please sign in to comment.