diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64e0a857..7fb31c0c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,9 @@ on: pull_request: workflow_call: +permissions: + contents: read + jobs: build_plugin: name: Build theme @@ -17,13 +20,15 @@ jobs: artifact_name: hello-elementor steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Set up Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: - node-version: 18.x + node-version: 22.x - name: Cache node modules - uses: actions/cache@v4 + uses: actions/cache@v6 env: cache-name: cache-node-modules with: @@ -44,19 +49,23 @@ jobs: echo "THEME_ZIP_FILENAME=$THEME_ZIP_FILENAME" >> "$GITHUB_ENV" - name: "Debug info: show tooling versions" continue-on-error: true + env: + DATE_VERSION: ${{ env.DATE_VERSION }} + PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }} + GITHUB_CONTEXT_JSON: ${{ toJson(github) }} run: | set +e echo "Start debug Info" - echo "Date: ${{ env.DATE_VERSION }}" + echo "Date: ${DATE_VERSION}" echo "PHP Version: $(php -v)" echo "Composer Version: $(composer --version)" echo "Node Version: $(node --version)" echo "NPM Version: $(npm --version)" echo "GIT Version: $(git --version)" echo "The github context is:" - echo "${{ toJson(github) }}" + echo "${GITHUB_CONTEXT_JSON}" echo "The Theme version is:" - echo "${{ env.PACKAGE_VERSION }}" + echo "${PACKAGE_VERSION}" echo "The Theme slug is:" echo "hello-elementor" echo "End debug Info" @@ -70,7 +79,7 @@ jobs: run: npm run zip - name: Upload zip file to GitHub actions artifact id: upload-artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: hello-elementor path: hello-elementor.*.zip @@ -106,12 +115,17 @@ jobs: edit-mode: replace - name: Print artifact info for fork PR if: github.event_name == 'pull_request' && !startsWith(github.event.pull_request.head.repo.full_name, 'elementor/') + env: + THEME_ZIP_FILENAME: ${{ env.THEME_ZIP_FILENAME }} + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_RUN_ID: ${{ github.run_id }} + ARTIFACT_ID: ${{ steps.upload-artifact.outputs.artifact-id }} run: | echo "Artifact info:" echo " Name: hello-elementor" - echo " Path: ${{ env.THEME_ZIP_FILENAME }}" - echo " Size: $(du -sh "${{ env.THEME_ZIP_FILENAME }}" | cut -f1)" - echo " URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.upload-artifact.outputs.artifact-id }}" + echo " Path: ${THEME_ZIP_FILENAME}" + echo " Size: $(du -sh "${THEME_ZIP_FILENAME}" | cut -f1)" + echo " URL: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts/${ARTIFACT_ID}" playground-preview: needs: [build_plugin] diff --git a/.github/workflows/cherry-pick-pr.yml b/.github/workflows/cherry-pick-pr.yml index ad5eb381..285a0403 100644 --- a/.github/workflows/cherry-pick-pr.yml +++ b/.github/workflows/cherry-pick-pr.yml @@ -7,21 +7,23 @@ on: - labeled permissions: - contents: write - pull-requests: write - actions: write + contents: read jobs: cherry-pick: if: ${{ github.event.pull_request.merged == true && github.event.pull_request.head.repo.full_name == github.repository && (github.event.action == 'closed' || (github.event.action == 'labeled' && startsWith(github.event.label.name, 'cp_'))) }} runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + actions: write env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: token: ${{ secrets.GITHUB_TOKEN }} ref: ${{ github.event.pull_request.base.ref }} @@ -30,8 +32,10 @@ jobs: - name: Get branch labels id: get_labels + env: + PR_LABELS_JSON: ${{ toJSON(github.event.pull_request.labels) }} run: | - LABELS=$(jq -r '.[].name' <<< '${{ toJSON(github.event.pull_request.labels) }}' | grep '^cp_' | paste -sd ',' || echo "") + LABELS=$(jq -r '.[].name' <<< "$PR_LABELS_JSON" | grep '^cp_' | paste -sd ',' || echo "") echo "filtered_labels_csv=$LABELS" >> "$GITHUB_OUTPUT" shell: bash @@ -46,19 +50,20 @@ jobs: PR_USER_LOGIN: ${{ github.event.pull_request.user.login }} LABEL_NAME: ${{ github.event.label.name }} SOURCE_REPO: ${{ github.event.pull_request.head.repo.full_name }} + PR_NUMBER: ${{ github.event.pull_request.number }} + MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }} + ORIG_URL: ${{ github.event.pull_request.html_url }} + ORIGINAL_BRANCH: ${{ github.event.pull_request.head.ref }} + EVENT_ACTION: ${{ github.event.action }} + FILTERED_LABELS_CSV: ${{ steps.get_labels.outputs.filtered_labels_csv }} run: | - PR_NUMBER="${{ github.event.pull_request.number }}" - MERGE_SHA="${{ github.event.pull_request.merge_commit_sha }}" - ORIG_URL="${{ github.event.pull_request.html_url }}" - git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - IFS=',' read -ra BRANCHES <<< "${{ steps.get_labels.outputs.filtered_labels_csv }}" + IFS=',' read -ra BRANCHES <<< "$FILTERED_LABELS_CSV" for lbl in "${BRANCHES[@]}"; do TARGET=${lbl#cp_} - ORIGINAL_BRANCH="${{ github.event.pull_request.head.ref }}" BRANCH=$(bash "${GITHUB_WORKSPACE}/.github/scripts/cherry-picking/generate-branch-name.sh" "$PR_NUMBER" "$TARGET" "$ORIGINAL_BRANCH") CONFLICT_BRANCH="${BRANCH}_conflicts" @@ -81,7 +86,7 @@ jobs: CONFLICT_TITLE="${CONFLICT_TITLE} with conflicts" CONFLICT_TRIGGER_INFO="" - if [ "${{ github.event.action }}" = "labeled" ]; then + if [ "$EVENT_ACTION" = "labeled" ]; then CONFLICT_TRIGGER_INFO=" **Trigger:** Label \`${LABEL_NAME}\` added to closed PR" fi @@ -134,7 +139,7 @@ jobs: PR_TITLE_GENERATED=$(bash "${GITHUB_WORKSPACE}/.github/scripts/cherry-picking/generate-pr-title.sh" "$PR_TITLE" "$PR_NUMBER" "$TARGET") TRIGGER_INFO="" - if [ "${{ github.event.action }}" = "labeled" ]; then + if [ "$EVENT_ACTION" = "labeled" ]; then TRIGGER_INFO=" **Trigger:** Label \`${LABEL_NAME}\` added to closed PR" fi diff --git a/.github/workflows/cherry-pick-validation.yml b/.github/workflows/cherry-pick-validation.yml index 0e0d946a..f27ccf50 100644 --- a/.github/workflows/cherry-pick-validation.yml +++ b/.github/workflows/cherry-pick-validation.yml @@ -21,16 +21,16 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 + persist-credentials: false - name: Extract cherry-pick information id: extract_info + env: + BRANCH_NAME: ${{ github.head_ref }} run: | - BRANCH_NAME="${{ github.head_ref }}" - # Extract PR number and target branch from branch name - # Format: cherry-pick-pr-{PR_NUMBER}-{TARGET_BRANCH} if [[ $BRANCH_NAME =~ cherry-pick-pr-([0-9]+)-([a-zA-Z0-9._/-]+) ]]; then ORIGINAL_PR="${BASH_REMATCH[1]}" TARGET_BRANCH="${BASH_REMATCH[2]}" @@ -168,16 +168,21 @@ jobs: echo "✅ Cherry-pick compatibility check passed" - name: Generate validation report + env: + HEAD_REF: ${{ github.head_ref }} + GITHUB_REPOSITORY: ${{ github.repository }} + ORIGINAL_PR: ${{ steps.extract_info.outputs.original_pr }} + TARGET_BRANCH: ${{ steps.extract_info.outputs.target_branch }} run: | echo "📊 Generating cherry-pick validation report..." cat << EOF > cherry-pick-validation-report.md # 🍒 Cherry-Pick Validation Report - **Branch:** \`${{ github.head_ref }}\` - **Original PR:** [#${{ steps.extract_info.outputs.original_pr }}](https://github.com/${{ github.repository }}/pull/${{ steps.extract_info.outputs.original_pr }}) - **Target Branch:** \`${{ steps.extract_info.outputs.target_branch }}\` - **Repository:** ${{ github.repository }} + **Branch:** \`${HEAD_REF}\` + **Original PR:** [#${ORIGINAL_PR}](https://github.com/${GITHUB_REPOSITORY}/pull/${ORIGINAL_PR}) + **Target Branch:** \`${TARGET_BRANCH}\` + **Repository:** ${GITHUB_REPOSITORY} ## ✅ Validation Results @@ -217,7 +222,7 @@ jobs: echo "✅ Validation report generated" - name: Post validation summary - uses: actions/github-script@v7 + uses: actions/github-script@v9 with: script: | const fs = require('fs'); diff --git a/.github/workflows/daily-test-matrix.yml b/.github/workflows/daily-test-matrix.yml index a55f453d..06750aa6 100644 --- a/.github/workflows/daily-test-matrix.yml +++ b/.github/workflows/daily-test-matrix.yml @@ -80,7 +80,7 @@ env: jobs: calculate-test-matrix: name: Calculate Dynamic Test Matrix - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest outputs: hello-theme-version: ${{ steps.matrix.outputs.hello-theme-version }} hello-plus-version: ${{ steps.matrix.outputs.hello-plus-version }} @@ -90,17 +90,25 @@ jobs: hello-theme-version-for-display: ${{ steps.matrix.outputs.hello-theme-version-for-display }} steps: - name: Checkout for scripts - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Calculate version matrix id: matrix + env: + INPUT_HELLO_THEME_VERSION: ${{ inputs.hello_theme_version || 'main' }} + INPUT_HELLO_PLUS_VERSION: ${{ inputs.hello_plus_version || 'latest-stable' }} + INPUT_ELEMENTOR_VERSION: ${{ inputs.elementor_version || 'main' }} + INPUT_COMPATIBILITY_DEPTH: ${{ inputs.compatibility_depth || '2' }} + INPUT_RUN_TARGETED_TESTS: ${{ inputs.run_targeted_tests || 'true' }} run: | - HT_VERSION="${{ inputs.hello_theme_version || 'main' }}" - HP_VERSION="${{ inputs.hello_plus_version || 'latest-stable' }}" - EL_VERSION="${{ inputs.elementor_version || 'main' }}" - DEPTH="${{ inputs.compatibility_depth || '2' }}" + HT_VERSION="${INPUT_HELLO_THEME_VERSION}" + HP_VERSION="${INPUT_HELLO_PLUS_VERSION}" + EL_VERSION="${INPUT_ELEMENTOR_VERSION}" + DEPTH="${INPUT_COMPATIBILITY_DEPTH}" - if [[ "${{ inputs.run_targeted_tests || 'true' }}" == "true" ]]; then + if [[ "${INPUT_RUN_TARGETED_TESTS}" == "true" ]]; then RUN_TARGETED_TESTS="true" else RUN_TARGETED_TESTS="false" @@ -111,7 +119,7 @@ jobs: notify-on-early-failure: name: Notify on Early Failure needs: calculate-test-matrix - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest if: always() && needs.calculate-test-matrix.result != 'success' steps: - name: Send Slack notification on early failure @@ -126,18 +134,20 @@ jobs: name: Trigger Targeted Tests needs: [calculate-test-matrix] if: ${{ needs.calculate-test-matrix.outputs.targeted-tests != '[]' }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: ${{ fromJson(needs.calculate-test-matrix.outputs.targeted-tests) }} steps: - name: Checkout Hello Theme - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Trigger targeted compatibility test id: trigger - uses: actions/github-script@v7 + uses: actions/github-script@v9 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -207,7 +217,7 @@ jobs: core.setOutput('metadata-filename', metadataFileName); - name: Upload run metadata - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: run-metadata-${{ matrix.combination }}-${{ github.run_id }}-${{ strategy.job-index }} path: ${{ steps.trigger.outputs.metadata-filename }} @@ -216,23 +226,25 @@ jobs: collect-matrix-results: name: Collect Matrix Results needs: [calculate-test-matrix, trigger-targeted-tests] - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest if: always() && needs.calculate-test-matrix.result == 'success' outputs: all-workflow-data: ${{ steps.collect-data.outputs.all-workflow-data }} steps: - name: Checkout for scripts - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Download all metadata artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: pattern: run-metadata-* merge-multiple: true - name: Collect workflow data id: collect-data - uses: actions/github-script@v7 + uses: actions/github-script@v9 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -268,17 +280,19 @@ jobs: daily-trigger-report: name: Daily Trigger Report needs: [calculate-test-matrix, trigger-targeted-tests, collect-matrix-results] - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest if: always() && needs.calculate-test-matrix.result == 'success' outputs: overall-status: ${{ steps.aggregate-status.outputs.overall-status }} test-summary: ${{ steps.aggregate-status.outputs.test-summary }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Generate Hello Theme daily test report - uses: actions/github-script@v7 + uses: actions/github-script@v9 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -310,7 +324,7 @@ jobs: - name: Aggregate test status id: aggregate-status - uses: actions/github-script@v7 + uses: actions/github-script@v9 with: script: | // Use the collected workflow data @@ -387,7 +401,7 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY - name: Final status check - uses: actions/github-script@v7 + uses: actions/github-script@v9 with: script: | const overallStatus = '${{ steps.aggregate-status.outputs.overall-status }}'; diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 44e61891..1b60c77c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,7 +17,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Test permissions uses: ./.github/workflows/permissions with: @@ -25,16 +27,18 @@ jobs: DEPLOYMENT_PERMITTED: ${{ vars.DEPLOYMENT_PERMITTED_USERS }} DEPLOYMENT_REPOSITORY_OWNER: elementor - name: Validate branch name + env: + REF_NAME: ${{ github.ref_name }} run: | - BRANCH_NAME="${{ github.ref_name }}" - if [[ ! "$BRANCH_NAME" =~ ^[0-9]+\.[0-9]+ ]]; then - echo "::error::Branch name must match pattern (e.g., 3.4, 3.5). Current branch: $BRANCH_NAME" + if [[ ! "$REF_NAME" =~ ^[0-9]+\.[0-9]+ ]]; then + echo "::error::Branch name must match pattern (e.g., 3.4, 3.5). Current branch: $REF_NAME" exit 1 fi - name: Validate version input + env: + INPUT_VERSION: ${{ inputs.version }} run: | PACKAGE_VERSION=$(cat package.json | jq -r '.version') - INPUT_VERSION="${{ inputs.version }}" if [ "$INPUT_VERSION" != "$PACKAGE_VERSION" ]; then echo "::error::Input version ($INPUT_VERSION) does not match package.json version ($PACKAGE_VERSION)" exit 1 @@ -56,12 +60,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Preparing envs run: | echo "THEME_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV - name: Download Artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: hello-elementor - name: Extract Hello Theme build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5296438e..34a3085f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,6 +2,9 @@ name: Lint on: [push, pull_request] +permissions: + contents: read + jobs: eslint: name: ESLint @@ -9,13 +12,15 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v7 with: - node-version: 18.x + node-version: 22.x - name: Cache node modules - uses: actions/cache@v3 + uses: actions/cache@v6 env: cache-name: cache-node-modules with: @@ -36,17 +41,19 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Setup PHP 7.4 - uses: shivammathur/setup-php@9882bed06691b3a085010c1602ce43ef18f15c5b # v2 + uses: shivammathur/setup-php@4424c9aab975b57bd706ee5a39c6b4334d6e4f60 # v2.40.0 with: php-version: '7.4' - name: Get composer cache directory id: composer-cache run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" + echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" - name: Cache composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v6 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} diff --git a/.github/workflows/permissions/action.yml b/.github/workflows/permissions/action.yml index 68675d37..e6ebf9c9 100644 --- a/.github/workflows/permissions/action.yml +++ b/.github/workflows/permissions/action.yml @@ -16,18 +16,24 @@ runs: using: "composite" steps: - shell: bash + env: + DEPLOYMENT_REPOSITORY_OWNER: ${{ inputs.DEPLOYMENT_REPOSITORY_OWNER }} + REPOSITORY_OWNER: ${{ github.event.repository.owner.login }} + DEPLOYMENT_PERMITTED: ${{ inputs.DEPLOYMENT_PERMITTED }} + ENVIRONMENT: ${{ inputs.ENVIRONMENT }} + GITHUB_ACTOR: ${{ github.actor }} run: | - if [[ "${{ inputs.DEPLOYMENT_REPOSITORY_OWNER }}" != "${{ github.event.repository.owner.login }}" ]];then + if [[ "$DEPLOYMENT_REPOSITORY_OWNER" != "$REPOSITORY_OWNER" ]];then echo "Pass validation outside of main repo owner" exit 0 fi - if [[ "${{ inputs.ENVIRONMENT }}" == "dev" ]];then + if [[ "$ENVIRONMENT" == "dev" ]];then echo "Pass validation in the development environment" exit 0 fi - permitted=",$(echo "${{ inputs.DEPLOYMENT_PERMITTED }}" | tr -d '[:space:]')," - actor=",${{ github.actor }}," + permitted=",$(echo "$DEPLOYMENT_PERMITTED" | tr -d '[:space:]')," + actor=",${GITHUB_ACTOR}," if ! echo "$permitted" | grep -Fiq "$actor"; then - echo "::error::No deployment permissions have been granted to the user : ${{ github.actor }}" + echo "::error::No deployment permissions have been granted to the user : ${GITHUB_ACTOR}" exit 1 fi diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 62e88455..f6b39cbb 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -38,7 +38,9 @@ jobs: php_diff: ${{ steps.php_diff_files.outputs.diff }} steps: - name: Checkout source code - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Check PHP files diff id: php_diff_files uses: technote-space/get-diff-action@v6 @@ -75,9 +77,10 @@ jobs: steps: - name: Checkout source code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 + persist-credentials: false - name: Setup PHP uses: shivammathur/setup-php@v2 with: diff --git a/.github/workflows/playground-preview.yml b/.github/workflows/playground-preview.yml index 695ae5b3..235bc2df 100644 --- a/.github/workflows/playground-preview.yml +++ b/.github/workflows/playground-preview.yml @@ -26,6 +26,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + with: + persist-credentials: false - name: Download theme artifact uses: actions/download-artifact@v8 diff --git a/.github/workflows/playwright-with-specific-elementor-version.yml b/.github/workflows/playwright-with-specific-elementor-version.yml index a812fbd0..483efa46 100644 --- a/.github/workflows/playwright-with-specific-elementor-version.yml +++ b/.github/workflows/playwright-with-specific-elementor-version.yml @@ -43,7 +43,7 @@ permissions: jobs: build-core-components: name: Build Core Components (Hello Theme + Elementor) - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest outputs: hello-theme-version: ${{ steps.set-versions.outputs.hello-theme-version }} elementor-core-branch: ${{ steps.set-versions.outputs.elementor-core-branch }} @@ -51,18 +51,19 @@ jobs: artifact-name: ${{ steps.set-versions.outputs.artifact-name }} steps: - name: Checkout Hello Theme - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 + persist-credentials: false - name: Install Node.js 20.x - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: - node-version: 20.x + node-version: 22.x cache: "npm" - name: Setup PHP - uses: shivammathur/setup-php@9882bed06691b3a085010c1602ce43ef18f15c5b # v2 + uses: shivammathur/setup-php@4424c9aab975b57bd706ee5a39c6b4334d6e4f60 # v2.40.0 with: php-version: "8.1" tools: composer @@ -123,7 +124,7 @@ jobs: run: bash .github/scripts/download-elementor-core.sh - name: Upload core build artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: ${{ steps.set-versions.outputs.artifact-name }} path: | @@ -147,25 +148,26 @@ jobs: HELLO_THEME_VERSION: ${{ needs.build-core-components.outputs.hello-theme-version }} ELEMENTOR_VERSION: ${{ needs.build-core-components.outputs.elementor-version }} RUN_IDENTIFIER: core-${{ github.event.inputs.hello_theme_version || github.ref }}-${{ github.run_id }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout Hello Theme - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 + persist-credentials: false - name: Extract tests from target version id: extract-version-tests run: bash .github/scripts/resolve-version-ref.sh extract-playwright-tests "${{ inputs.hello_theme_version || 'main' }}" --fetch - name: Install Node.js 20.x - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: - node-version: 20.x + node-version: 22.x cache: "npm" - name: Setup PHP - uses: shivammathur/setup-php@9882bed06691b3a085010c1602ce43ef18f15c5b # v2 + uses: shivammathur/setup-php@4424c9aab975b57bd706ee5a39c6b4334d6e4f60 # v2.40.0 with: php-version: "8.1" tools: composer @@ -179,7 +181,7 @@ jobs: composer install --no-dev --no-scripts --optimize-autoloader --quiet - name: Download build artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: ${{ needs.build-core-components.outputs.artifact-name }} path: ./ @@ -251,7 +253,7 @@ jobs: echo "This is expected for older versions that predate Playwright testing" - name: Upload core test results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 if: always() with: name: core-test-results-ht${{ env.HELLO_THEME_VERSION }}-el${{ env.ELEMENTOR_VERSION }} @@ -260,7 +262,7 @@ jobs: retention-days: 3 - name: Upload Core Playwright HTML report - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 if: always() with: name: core-playwright-report-ht${{ env.HELLO_THEME_VERSION }}-el${{ env.ELEMENTOR_VERSION }} @@ -279,25 +281,26 @@ jobs: env: HELLO_THEME_VERSION: ${{ needs.build-core-components.outputs.hello-theme-version }} ELEMENTOR_VERSION: ${{ needs.build-core-components.outputs.elementor-version }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout Hello Theme - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 + persist-credentials: false - name: Extract tests from target version id: extract-version-tests run: bash .github/scripts/resolve-version-ref.sh extract-playwright-tests "${{ inputs.hello_theme_version || 'main' }}" --fetch - name: Install Node.js 20.x - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: - node-version: 20.x + node-version: 22.x cache: "npm" - name: Setup PHP - uses: shivammathur/setup-php@9882bed06691b3a085010c1602ce43ef18f15c5b # v2 + uses: shivammathur/setup-php@4424c9aab975b57bd706ee5a39c6b4334d6e4f60 # v2.40.0 with: php-version: "8.1" tools: composer @@ -311,7 +314,7 @@ jobs: composer install --no-dev --no-scripts --optimize-autoloader --quiet - name: Download build artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: ${{ needs.build-core-components.outputs.artifact-name }} path: ./ @@ -361,11 +364,13 @@ jobs: - name: Run Hello Theme tagged tests only if: steps.extract-version-tests.outputs.tests-available == 'true' + env: + PLAYWRIGHT_TAG: ${{ inputs.tag || github.event.inputs.tag }} run: | export DAILY_MATRIX_WORKFLOW=true echo "Running tagged tests from: ${{ steps.extract-version-tests.outputs.test-source-type }}" # Only run Hello Theme tests with the specified tag - npm run test:playwright -- tests/playwright/tests/ --grep="${{ github.event.inputs.tag }}" + npm run test:playwright -- tests/playwright/tests/ --grep="${PLAYWRIGHT_TAG}" - name: Skip tagged tests - version incompatible if: steps.extract-version-tests.outputs.tests-available != 'true' @@ -375,7 +380,7 @@ jobs: echo "This is expected for older versions that predate Playwright testing" - name: Upload core tagged test results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 if: always() with: name: core-tagged-test-results-ht${{ env.HELLO_THEME_VERSION }}-el${{ env.ELEMENTOR_VERSION }} @@ -384,7 +389,7 @@ jobs: retention-days: 3 - name: Upload Core Tagged Playwright HTML report - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 if: always() with: name: core-tagged-playwright-report-ht${{ env.HELLO_THEME_VERSION }}-el${{ env.ELEMENTOR_VERSION }} @@ -399,7 +404,7 @@ jobs: core-matrix-results: needs: [core-playwright-tests, core-playwright-tagged-tests] if: needs.core-playwright-tests.result != 'skipped' || needs.core-playwright-tagged-tests.result != 'skipped' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest name: Core Matrix - Test Results steps: - name: Core Matrix test status diff --git a/.github/workflows/playwright-with-specific-hello-plus-version.yml b/.github/workflows/playwright-with-specific-hello-plus-version.yml index 8f8de683..531980b2 100644 --- a/.github/workflows/playwright-with-specific-hello-plus-version.yml +++ b/.github/workflows/playwright-with-specific-hello-plus-version.yml @@ -42,7 +42,7 @@ permissions: jobs: build-plus-components: name: Build Plus Components (Hello Theme + Hello Plus) - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest outputs: hello-theme-version: ${{ steps.set-versions.outputs.hello-theme-version }} hello-plus-version: ${{ steps.set-versions.outputs.hello-plus-version }} @@ -50,18 +50,19 @@ jobs: artifact-name: ${{ steps.set-versions.outputs.artifact-name }} steps: - name: Checkout Hello Theme - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 + persist-credentials: false - name: Install Node.js 20.x - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: - node-version: 20.x + node-version: 22.x cache: "npm" - name: Setup PHP - uses: shivammathur/setup-php@9882bed06691b3a085010c1602ce43ef18f15c5b # v2 + uses: shivammathur/setup-php@4424c9aab975b57bd706ee5a39c6b4334d6e4f60 # v2.40.0 with: php-version: "8.1" tools: composer @@ -139,7 +140,7 @@ jobs: run: bash .github/scripts/download-elementor-core.sh - name: Upload plus build artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: ${{ steps.set-versions.outputs.artifact-name }} path: | @@ -166,25 +167,26 @@ jobs: HELLO_PLUS_VERSION: ${{ needs.build-plus-components.outputs.hello-plus-version }} ELEMENTOR_VERSION: ${{ needs.build-plus-components.outputs.elementor-version }} RUN_IDENTIFIER: plus-${{ github.event.inputs.hello_theme_version || github.ref }}-${{ github.run_id }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout Hello Theme - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 + persist-credentials: false - name: Extract tests from target version id: extract-version-tests run: bash .github/scripts/resolve-version-ref.sh extract-playwright-tests "${{ inputs.hello_theme_version || 'main' }}" --fetch - name: Install Node.js 20.x - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: - node-version: 20.x + node-version: 22.x cache: "npm" - name: Setup PHP - uses: shivammathur/setup-php@9882bed06691b3a085010c1602ce43ef18f15c5b # v2 + uses: shivammathur/setup-php@4424c9aab975b57bd706ee5a39c6b4334d6e4f60 # v2.40.0 with: php-version: "8.1" tools: composer @@ -198,7 +200,7 @@ jobs: composer install --no-dev --no-scripts --optimize-autoloader --quiet - name: Download build artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: ${{ needs.build-plus-components.outputs.artifact-name }} path: ./ @@ -268,7 +270,7 @@ jobs: echo "This is expected for older versions that predate Playwright testing" - name: Upload plus test results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 if: always() with: name: plus-test-results-ht${{ env.HELLO_THEME_VERSION }}-hp${{ env.HELLO_PLUS_VERSION }} @@ -277,7 +279,7 @@ jobs: retention-days: 3 - name: Upload Plus Playwright HTML report - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 if: always() with: name: plus-playwright-report-ht${{ env.HELLO_THEME_VERSION }}-hp${{ env.HELLO_PLUS_VERSION }} @@ -297,25 +299,26 @@ jobs: HELLO_THEME_VERSION: ${{ needs.build-plus-components.outputs.hello-theme-version }} HELLO_PLUS_VERSION: ${{ needs.build-plus-components.outputs.hello-plus-version }} ELEMENTOR_VERSION: ${{ needs.build-plus-components.outputs.elementor-version }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout Hello Theme - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 + persist-credentials: false - name: Extract tests from target version id: extract-version-tests run: bash .github/scripts/resolve-version-ref.sh extract-playwright-tests "${{ inputs.hello_theme_version || 'main' }}" --fetch - name: Install Node.js 20.x - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: - node-version: 20.x + node-version: 22.x cache: "npm" - name: Setup PHP - uses: shivammathur/setup-php@9882bed06691b3a085010c1602ce43ef18f15c5b # v2 + uses: shivammathur/setup-php@4424c9aab975b57bd706ee5a39c6b4334d6e4f60 # v2.40.0 with: php-version: "8.1" tools: composer @@ -329,7 +332,7 @@ jobs: composer install --no-dev --no-scripts --optimize-autoloader --quiet - name: Download build artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: ${{ needs.build-plus-components.outputs.artifact-name }} path: ./ @@ -377,10 +380,12 @@ jobs: - name: Run Hello Theme tagged tests only if: steps.extract-version-tests.outputs.tests-available == 'true' + env: + PLAYWRIGHT_TAG: ${{ inputs.tag || github.event.inputs.tag }} run: | echo "Running tagged tests from: ${{ steps.extract-version-tests.outputs.test-source-type }}" # Only run Hello Theme tests with the specified tag - npm run test:playwright -- tests/playwright/tests/ --grep="${{ github.event.inputs.tag }}" + npm run test:playwright -- tests/playwright/tests/ --grep="${PLAYWRIGHT_TAG}" - name: Skip tagged tests - version incompatible if: steps.extract-version-tests.outputs.tests-available != 'true' @@ -390,7 +395,7 @@ jobs: echo "This is expected for older versions that predate Playwright testing" - name: Upload plus tagged test results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 if: always() with: name: plus-tagged-test-results-ht${{ env.HELLO_THEME_VERSION }}-hp${{ env.HELLO_PLUS_VERSION }} @@ -399,7 +404,7 @@ jobs: retention-days: 3 - name: Upload Plus Tagged Playwright HTML report - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 if: always() with: name: plus-tagged-playwright-report-ht${{ env.HELLO_THEME_VERSION }}-hp${{ env.HELLO_PLUS_VERSION }} @@ -414,7 +419,7 @@ jobs: plus-matrix-results: needs: [plus-playwright-tests, plus-playwright-tagged-tests] if: needs.plus-playwright-tests.result != 'skipped' || needs.plus-playwright-tagged-tests.result != 'skipped' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest name: Plus Matrix - Test Results steps: - name: Plus Matrix test status diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 9bb0bff9..fc3d36c5 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -6,20 +6,23 @@ on: permissions: contents: read - actions: write jobs: playwright-tests: runs-on: ubuntu-latest + permissions: + actions: write steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: - node-version: '20' + node-version: '22' cache: 'npm' registry-url: 'https://npm.pkg.github.com' scope: '@elementor' @@ -58,7 +61,7 @@ jobs: echo "exit_code=$?" >> $GITHUB_OUTPUT continue-on-error: false - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 if: always() with: name: playwright-test-results-${{ matrix.shardIndex }}