Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
This reverts commit 929fb09.
npm ci requires a package-lock.json in the prefix directory, but when this action is consumed remotely only the action subdirectory is fetched — without the monorepo root lockfile. Ref: ED-24451 Co-authored-by: Cursor <cursoragent@cursor.com>
The action is fetched in isolation (no monorepo root), so the local workspace package @elementor/editor-github-actions-utils is unavailable at runtime. Inline the three used functions directly. Ref: ED-24451 Co-authored-by: Cursor <cursoragent@cursor.com>
main.ts was only exporting run() without calling it, so no outputs were written. Also add "type": "module" to suppress Node warning. Ref: ED-24451 Co-authored-by: Cursor <cursoragent@cursor.com>
Node's ESM resolver requires explicit file extensions. Without them, importing './current-version-validation' fails at runtime. Ref: ED-24451 Co-authored-by: Cursor <cursoragent@cursor.com>
- action.yml: move all ${{ expr }} references out of inline shell scripts
into env: vars so they are never interpolated by the shell
- main.ts: replace execSync with interpolated string with spawnSync
and an args array to prevent command injection via INPUT_VERSION
Ref: ED-24451
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
Adds a new “two-step” release tag creation flow by introducing a dedicated GitHub Action and shared utilities for patching version-related files, along with a CI test pipeline to validate the behavior.
Changes:
- Introduces
actions/release-tag-creationaction (validation, tag derivation, version-file updates) plus tests. - Adds version-file patching/tag-parsing helpers to
@elementor/editor-github-actions-utilswith Vitest coverage. - Adds a
testTurbo task and a PR workflow test job; adjusts TS config and Node engine requirements.
Reviewed changes
Copilot reviewed 14 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
turbo.json |
Adds a test task to the Turbo pipeline. |
tsconfig.json |
Enables importing .ts extensions (affects module resolution/typecheck). |
packages/editor-github-actions-utils/src/version-files.ts |
Adds helpers for patching version markers and parsing latest tags from ls-remote. |
packages/editor-github-actions-utils/src/version-files.test.ts |
Adds Vitest coverage for the new utils helpers. |
packages/editor-github-actions-utils/src/index.ts |
Re-exports the new version-files module. |
packages/editor-github-actions-utils/package.json |
Adds Vitest scripts/dependency for the utils package tests. |
package.json |
Adds root test script and bumps Node engine requirement. |
package-lock.json |
Updates lockfile for new workspace/package dependencies and version bumps. |
actions/trickle-down-changelog/main.ts |
Tweaks PR message formatting (removes v prefix). |
actions/release-tag-creation/update-version-files.ts |
Implements readme/elementor.php patching + output capture for the action. |
actions/release-tag-creation/package.json |
Adds the new action package manifest and Vitest config. |
actions/release-tag-creation/main.ts |
Implements version input parsing/validation and derives channel/branch/companion tag. |
actions/release-tag-creation/current-version-validation.ts |
Implements “next version” validation based on remote tags. |
actions/release-tag-creation/current-version-validation.test.ts |
Adds unit tests for “next version” validation. |
actions/release-tag-creation/action.yml |
Defines the composite action steps (install, validate, patch, commit, tag). |
.github/workflows/pr.yml |
Adds a dedicated test job to PR checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Handle version input | ||
| id: handle-version-input | ||
| shell: bash | ||
| env: | ||
| INPUT_VERSION: ${{ inputs.version }} | ||
| ACTION_PATH: ${{ github.action_path }} | ||
| run: node "$ACTION_PATH/main.ts" | ||
|
|
| "dependencies": { | ||
| "@actions/core": "^1.11.1", | ||
| "semver": "^7.7.2" | ||
| }, |
| "engines": { | ||
| "node": ">=20.6.0", | ||
| "node": ">=24.0.0", | ||
| "npm": ">=10.0.0" | ||
| }, |
| const tags = lsRemoteOutput | ||
| .split('\n') | ||
| .map((line) => line.split('\t')[1] ?? '') | ||
| .map((ref) => ref.replace(/^refs\/tags\/v?/, '')) | ||
| .filter((tag) => pattern.test(tag)) | ||
| .sort((a, b) => { | ||
| // Semantic version sort: split on dots and numeric pre-release parts | ||
| const toparts = (v: string) => | ||
| v.split(/[.\-]/).map((p) => (isNaN(Number(p)) ? p : Number(p))); | ||
| const ap = toparts(a); | ||
| const bp = toparts(b); | ||
| for (let i = 0; i < Math.max(ap.length, bp.length); i++) { | ||
| const ai = ap[i] ?? 0; | ||
| const bi = bp[i] ?? 0; | ||
| if (ai < bi) return -1; | ||
| if (ai > bi) return 1; | ||
| } | ||
| return 0; | ||
| }); |
| return tagsOutput | ||
| .split('\n') | ||
| .map((line) => line.split('\t')[1]?.replace('refs/tags/', '').trim()) | ||
| .filter((tag): tag is string => { | ||
| if (!tag || !ALLOWED_PATTERN.test(tag)) return false; |
Apply Prettier formatting to release-tag-creation files and version-files utilities. Remove unnecessary regex escape in version-files.ts. Activate Elementor plugin in setup-elementor-env instead of only validating it, fixing the Performance flow CI job where wp-env installs but does not auto-activate plugins. Ref: ED-24451 Co-authored-by: Netanel Baba <Ntnelbaba@users.noreply.github.com>
Latest Elementor from wordpress.org requires WordPress 6.8 minimum. Update the Test Actions workflow to match. Ref: ED-24451 Co-authored-by: Netanel Baba <Ntnelbaba@users.noreply.github.com>
| "engines": { | ||
| "node": ">=20.6.0", | ||
| "node": ">=24.0.0", | ||
| "npm": ">=10.0.0" | ||
| }, |
| const tags = lsRemoteOutput | ||
| .split('\n') | ||
| .map((line) => line.split('\t')[1] ?? '') | ||
| .map((ref) => ref.replace(/^refs\/tags\/v?/, '')) | ||
| .filter((tag) => pattern.test(tag)) | ||
| .sort((a, b) => { | ||
| // Semantic version sort: split on dots and numeric pre-release parts | ||
| const toparts = (v: string) => | ||
| v.split(/[.\-]/).map((p) => (isNaN(Number(p)) ? p : Number(p))); | ||
| const ap = toparts(a); | ||
| const bp = toparts(b); | ||
| for (let i = 0; i < Math.max(ap.length, bp.length); i++) { | ||
| const ai = ap[i] ?? 0; | ||
| const bi = bp[i] ?? 0; | ||
| if (ai < bi) return -1; | ||
| if (ai > bi) return 1; | ||
| } | ||
| return 0; | ||
| }); |
| export function patchPhpVersion(content: string, version: string): string { | ||
| return content | ||
| .replace(/( \* Version: ).*/g, `$1${version}`) | ||
| .replace(/(define\( 'ELEMENTOR_VERSION', ')[^']*'/, `$1${version}'`); |
There was a problem hiding this comment.
We can simply add all the places for all the possible options, this will simply skip if the regex not exists
There was a problem hiding this comment.
For Pro, it will also need the 2 versions back version value, and without the suffix
| - name: Checkout source code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Dependencies |
There was a problem hiding this comment.
Make sure it uses the correct node version
| const channel = getEnv('INPUT_CHANNEL'); | ||
| const companionTag = getEnv('INPUT_COMPANION_TAG'); | ||
|
|
||
| // ── elementor.php ──────────────────────────────────────────────────────── |
| @@ -0,0 +1,93 @@ | |||
| import { readFileSync, writeFileSync, appendFileSync } from 'node:fs'; | |||
|
|
|||
| function patchPhpVersion(content: string, version: string): string { | |||
| "dependencies": { | ||
| "@actions/core": "^1.11.1", | ||
| "semver": "^7.7.2" | ||
| }, |
No description provided.