elementor/scripts
Netanel Baba 3ef3f7f0bd
Internal: Update branchout script to handle 4.0x branches [ED-23982] (#35724)
## Summary
- Zero-pad the minor version in the generated release branch name so
that branches `4.00`–`4.10` sort correctly lexicographically
- Updated `scripts/create-version-change.js`: use
`String(minor).padStart(2, '0')` instead of bare `minor`
- Updated `.github/workflows/create-version-change.yml`: use `printf
'%02d' $MINOR` instead of bare `$MINOR`

## Test plan
- [ ] Run `node scripts/create-version-change.js` when `package.json`
version is `4.2.0` and verify the branch name shown is `4.02` (not
`4.2`)
- [ ] Confirm branches sort correctly: `echo -e "4.02\n4.10\n4.09" |
sort -V` should output `4.02 → 4.09 → 4.10`
- [ ] Verify that versions >= `4.10` remain unaffected (no
triple-padding)

## Jira
[ED-23982](https://elementor.atlassian.net/browse/ED-23982)

[ED-23982]:
https://elementor.atlassian.net/browse/ED-23982?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!--start_gitstream_placeholder-->
###  PR Description
## 1. Problem & Context

Branch names like `4.0` were inconsistent with the upcoming `4.0x`
versioning scheme. This standardizes branch naming to zero-pad minor
versions (e.g., `4.00`, `4.01`) across both the Node.js script and
GitHub Actions workflow, ensuring consistency as versions progress
beyond single digits.

## 2. What Changed (Where)

- `scripts/create-version-change.js`: Updated branch name format from
`${major}.${minor}` to `${major}.${String(minor).padStart(2, '0')}`
- `.github/workflows/create-version-change.yml`: Updated shell branch
name format from `${MAJOR}.${MINOR}` to `${MAJOR}.$(printf '%02d'
$MINOR)`

## 3. How It Works

Both files now zero-pad the minor version to two digits when
constructing branch names. The JavaScript implementation uses
`String.padStart(2, '0')` while the bash workflow uses `printf '%02d'`.
For version `4.0`, branch name becomes `4.00`; for `4.1` it becomes
`4.01`, and so on through `4.99`.

## 4. Risks

Existing branches with old naming format (`4.0`) won't automatically map
to new format (`4.00`). Verify that any branch references in CI/CD,
merge scripts, or documentation are updated to match the new convention.

_Generated by LinearB AI and added by gitStream._
<sub>AI-generated content may contain inaccuracies. Please verify before
using.
💡 **Tip:** You can customize your AI Description using **Guidelines**
[Learn
how](https://docs.gitstream.cm/automation-actions/#describe-changes)</sub>
<!--end_gitstream_placeholder-->
2026-05-06 14:55:58 +00:00
..
create-version-change.js Internal: Update branchout script to handle 4.0x branches [ED-23982] (#35724) 2026-05-06 14:55:58 +00:00
lint-packages-staged.js Internal: Add lint-stage to pre-commit hook [ED-20379] (#34473) 2026-01-28 15:47:57 +00:00
setup-test-environment.sh Internal: Convert to single turbo monorepo with unified workspace [ED-23202] (#35005) 2026-03-08 13:08:44 +02:00
setup-testing.sh Internal: Create a way for rendering elements inside an element with default settings [ED-20245] (#32407) 2025-08-25 14:54:38 +03:00