Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
pull_request:
workflow_call:

permissions:
contents: read

jobs:
build_plugin:
name: Build theme
Expand All @@ -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:
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand Down
31 changes: 18 additions & 13 deletions .github/workflows/cherry-pick-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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

Expand All @@ -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"

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/cherry-pick-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]}"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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');
Expand Down
56 changes: 35 additions & 21 deletions .github/workflows/daily-test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,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 }}
Expand All @@ -87,17 +87,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"
Expand All @@ -108,7 +116,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
Expand All @@ -123,18 +131,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: |
Expand Down Expand Up @@ -204,7 +214,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 }}
Expand All @@ -213,23 +223,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: |
Expand Down Expand Up @@ -265,17 +277,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: |
Expand Down Expand Up @@ -307,7 +321,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
Expand Down Expand Up @@ -384,7 +398,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 }}';
Expand Down
Loading
Loading