Skip to content

Commit

Permalink
refactor(000): update branch name generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Stoyan Delev committed Apr 10, 2023
1 parent 74d5529 commit 70b9598
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions scripts/branch-name-to-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ module.exports.branchNameToUrl = branchName => {

const removeNonAz09Dash = /[^a-zA-Z0-9 -]/;

const sitePath = branchName
.split('/')[1]
.toLowerCase()
.trim()
.replace(removeNonAz09Dash);
const branchNameParts = branchName.split('/');
const branchBase = branchNameParts[1] || branchNameParts[0];

const sitePath = branchBase.toLowerCase().trim().replace(removeNonAz09Dash);

if (!sitePath) {
process.stderr.write(`Could not parse branch:${branchName}`);
Expand Down

0 comments on commit 70b9598

Please sign in to comment.