From 066858da389d0b21b5e4a01111850f2d9d333a17 Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Wed, 2 Jul 2025 11:50:37 +0100 Subject: [PATCH 1/6] Renamed composer package name to composer-packages.json to avoid confusion with npm package.json --- .github/scripts/update_composer_package.sh | 4 ++-- plugins/{package.json => composer-packages.json} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename plugins/{package.json => composer-packages.json} (100%) diff --git a/.github/scripts/update_composer_package.sh b/.github/scripts/update_composer_package.sh index b0db1833..bdc0f7b8 100755 --- a/.github/scripts/update_composer_package.sh +++ b/.github/scripts/update_composer_package.sh @@ -23,7 +23,7 @@ usage() { echo " With custom package name and description:" echo " $0 '0.0.5' 'https://example.com/plugin.zip' 'wpengine/my-plugin' 'My custom plugin description'" echo "" - echo "Note: Updates plugins/package.json file" + echo "Note: Updates plugins/composer-packages.json file" exit 1 } @@ -38,7 +38,7 @@ VERSION="$1" RELEASE_URL="$2" PACKAGE_NAME="$3" DESCRIPTION="$4" -COMPOSER_FILE="plugins/package.json" +COMPOSER_FILE="plugins/composer-packages.json" # Function to extract package name from release URL extract_package_name() { diff --git a/plugins/package.json b/plugins/composer-packages.json similarity index 100% rename from plugins/package.json rename to plugins/composer-packages.json From 6b97796ecabe937278f1dbe34f5489fc8773b134 Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Wed, 2 Jul 2025 13:17:12 +0100 Subject: [PATCH 2/6] Fixes for workflows when merged into main and there is event pull request sha so the process fails and causes our badges to fail too. --- .github/scripts/get_plugin_slug.sh | 2 +- .github/workflows/code-quality.yml | 6 +++++- .github/workflows/codeception.yml | 6 +++++- .github/workflows/e2e-test.yml | 6 +++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/scripts/get_plugin_slug.sh b/.github/scripts/get_plugin_slug.sh index 8a3591f0..3768a4c9 100644 --- a/.github/scripts/get_plugin_slug.sh +++ b/.github/scripts/get_plugin_slug.sh @@ -8,7 +8,7 @@ HEAD_SHA="$2" git fetch --prune --unshallow 2>/dev/null || git fetch --prune # Get changed files in plugins subdirectories -if [ "$BASE_SHA" = "release" ]; then +if [ "$BASE_SHA" = "release" ] || [ "$BASE_SHA" = "main" ]; then CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD | grep '^plugins/[^/]\+/' || true) else CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep '^plugins/[^/]\+/' || true) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index e656bd22..49d64eef 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -31,7 +31,11 @@ jobs: - name: Get changed plugin directory id: plugin run: | - bash .github/scripts/get_plugin_slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }} + if [ "${{ github.event_name }}" = "push" ]; then + bash .github/scripts/get_plugin_slug.sh main + else + bash .github/scripts/get_plugin_slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }} + fi - name: Detect changed plugins with quality config id: detect diff --git a/.github/workflows/codeception.yml b/.github/workflows/codeception.yml index db4816c3..4fcaa417 100644 --- a/.github/workflows/codeception.yml +++ b/.github/workflows/codeception.yml @@ -38,7 +38,11 @@ jobs: - name: Get changed plugin directory id: plugin run: | - bash .github/scripts/get_plugin_slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }} + if [ "${{ github.event_name }}" = "push" ]; then + bash .github/scripts/get_plugin_slug.sh main + else + bash .github/scripts/get_plugin_slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }} + fi - name: Detect changed plugins with quality config id: detect diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index dd6c6986..ecc4437d 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -37,7 +37,11 @@ jobs: - name: Get changed plugin directory id: plugin run: | - bash .github/scripts/get_plugin_slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }} + if [ "${{ github.event_name }}" = "push" ]; then + bash .github/scripts/get_plugin_slug.sh main + else + bash .github/scripts/get_plugin_slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }} + fi - name: Detect changed plugin with E2E config id: detect From dfd3ee1ba8718b3dff0b4124ab9cc14b230a59ed Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Wed, 2 Jul 2025 13:29:11 +0100 Subject: [PATCH 3/6] Fixed paths not to run unless its a plugin not plugins/composer-packages.json is modified as this is not a plugin. --- .github/workflows/code-quality.yml | 4 ++-- .github/workflows/codeception.yml | 4 ++-- .github/workflows/create-release-branch.yml | 2 +- .github/workflows/e2e-test.yml | 5 ++++- .github/workflows/plugin-artifact-for-pr.yml | 8 ++++---- .github/workflows/pre-release-tag.yml | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 49d64eef..e734ed03 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -12,10 +12,10 @@ on: branches: - main paths: - - 'plugins/**.php' + - 'plugins/*/*.php' pull_request: paths: - - 'plugins/**.php' + - 'plugins/*/*.php' jobs: detect-plugins: diff --git a/.github/workflows/codeception.yml b/.github/workflows/codeception.yml index 4fcaa417..187666fd 100644 --- a/.github/workflows/codeception.yml +++ b/.github/workflows/codeception.yml @@ -12,10 +12,10 @@ on: branches: - main paths: - - 'plugins/**.php' + - 'plugins/*/*.php' pull_request: paths: - - 'plugins/**.php' + - 'plugins/*/*.php' # Cancel previous workflow run groups that have not completed. concurrency: diff --git a/.github/workflows/create-release-branch.yml b/.github/workflows/create-release-branch.yml index c2759e8a..3b59ac0d 100644 --- a/.github/workflows/create-release-branch.yml +++ b/.github/workflows/create-release-branch.yml @@ -8,7 +8,7 @@ on: branches: - main paths: - - "plugins/**" + - "plugins/*/*" permissions: contents: write # Allow actions to read and write repository contents diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index ecc4437d..040b85f9 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -21,7 +21,10 @@ on: branches: - main paths: - - "plugins/**" + - 'plugins/**.php' + - 'plugins/**.js' + - 'plugins/**.css' + - 'plugins/**.json' jobs: detect-plugin: diff --git a/.github/workflows/plugin-artifact-for-pr.yml b/.github/workflows/plugin-artifact-for-pr.yml index 657dc279..9a50776c 100644 --- a/.github/workflows/plugin-artifact-for-pr.yml +++ b/.github/workflows/plugin-artifact-for-pr.yml @@ -3,10 +3,10 @@ name: Plugin Artifact for PR on: pull_request: paths: - - 'plugins/**.php' - - 'plugins/**.js' - - 'plugins/**.css' - - 'plugins/**.json' + - 'plugins/*/*.php' + - 'plugins/*/*.js' + - 'plugins/*/*.css' + - 'plugins/*/*.json' jobs: create-plugin-artifact: diff --git a/.github/workflows/pre-release-tag.yml b/.github/workflows/pre-release-tag.yml index 7e5d94ea..a3348a33 100644 --- a/.github/workflows/pre-release-tag.yml +++ b/.github/workflows/pre-release-tag.yml @@ -10,7 +10,7 @@ on: branches: - main paths: - - "plugins/**" + - "plugins/*/*" permissions: contents: write From 19b9c90a00ce8aee21e446244db3f33172fbc3be Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Wed, 2 Jul 2025 13:30:39 +0100 Subject: [PATCH 4/6] Forgot to update e2e test. --- .github/workflows/e2e-test.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 040b85f9..03dae321 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -13,18 +13,18 @@ on: branches: - main paths: - - 'plugins/**.php' - - 'plugins/**.js' - - 'plugins/**.css' - - 'plugins/**.json' + - 'plugins/*/*.php' + - 'plugins/*/*.js' + - 'plugins/*/*.css' + - 'plugins/*/*.json' pull_request: branches: - main paths: - - 'plugins/**.php' - - 'plugins/**.js' - - 'plugins/**.css' - - 'plugins/**.json' + - 'plugins/*/*.php' + - 'plugins/*/*.js' + - 'plugins/*/*.css' + - 'plugins/*/*.json' jobs: detect-plugin: From 73689326a2e509d46ec02ab51babc38a56033653 Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Wed, 2 Jul 2025 13:33:11 +0100 Subject: [PATCH 5/6] Removed comments to force an update for previews to test new workflow change. --- plugins/hwp-previews/tests/bootstrap.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/hwp-previews/tests/bootstrap.php b/plugins/hwp-previews/tests/bootstrap.php index c9e58949..4674b368 100644 --- a/plugins/hwp-previews/tests/bootstrap.php +++ b/plugins/hwp-previews/tests/bootstrap.php @@ -7,17 +7,14 @@ * @link https://github.com/wpengine/hwptoolkit/blob/main/plugins/hwp-previews/TESTING.md */ -// Ensure proper autoloading if (file_exists(__DIR__ . '/../../vendor/autoload.php')) { require_once __DIR__ . '/../../vendor/autoload.php'; } -// Load the main plugin file to ensure all classes are available if (file_exists(__DIR__ . '/../../hwp-previews.php')) { require_once __DIR__ . '/../../hwp-previews.php'; } -// Load access functions if they exist if (file_exists(__DIR__ . '/../../access-functions.php')) { require_once __DIR__ . '/../../access-functions.php'; } From bb3bb2eae83c5b8148d498515b596251397db821 Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Wed, 2 Jul 2025 13:47:14 +0100 Subject: [PATCH 6/6] Fixed sub-directory pattern. --- .github/workflows/code-quality.yml | 4 ++-- .github/workflows/codeception.yml | 4 ++-- .github/workflows/create-release-branch.yml | 2 +- .github/workflows/e2e-test.yml | 16 ++++++++-------- .github/workflows/plugin-artifact-for-pr.yml | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index e734ed03..af169d0c 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -12,10 +12,10 @@ on: branches: - main paths: - - 'plugins/*/*.php' + - 'plugins/*/**.php' pull_request: paths: - - 'plugins/*/*.php' + - 'plugins/*/**.php' jobs: detect-plugins: diff --git a/.github/workflows/codeception.yml b/.github/workflows/codeception.yml index 187666fd..f32f62af 100644 --- a/.github/workflows/codeception.yml +++ b/.github/workflows/codeception.yml @@ -12,10 +12,10 @@ on: branches: - main paths: - - 'plugins/*/*.php' + - 'plugins/*/**.php' pull_request: paths: - - 'plugins/*/*.php' + - 'plugins/*/**.php' # Cancel previous workflow run groups that have not completed. concurrency: diff --git a/.github/workflows/create-release-branch.yml b/.github/workflows/create-release-branch.yml index 3b59ac0d..e0bef01b 100644 --- a/.github/workflows/create-release-branch.yml +++ b/.github/workflows/create-release-branch.yml @@ -8,7 +8,7 @@ on: branches: - main paths: - - "plugins/*/*" + - "plugins/*/**" permissions: contents: write # Allow actions to read and write repository contents diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 03dae321..6e622d81 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -13,18 +13,18 @@ on: branches: - main paths: - - 'plugins/*/*.php' - - 'plugins/*/*.js' - - 'plugins/*/*.css' - - 'plugins/*/*.json' + - 'plugins/*/**.php' + - 'plugins/*/**.js' + - 'plugins/*/**.css' + - 'plugins/*/**.json' pull_request: branches: - main paths: - - 'plugins/*/*.php' - - 'plugins/*/*.js' - - 'plugins/*/*.css' - - 'plugins/*/*.json' + - 'plugins/*/**.php' + - 'plugins/*/**.js' + - 'plugins/*/**.css' + - 'plugins/*/**.json' jobs: detect-plugin: diff --git a/.github/workflows/plugin-artifact-for-pr.yml b/.github/workflows/plugin-artifact-for-pr.yml index 9a50776c..33fc1ed6 100644 --- a/.github/workflows/plugin-artifact-for-pr.yml +++ b/.github/workflows/plugin-artifact-for-pr.yml @@ -3,10 +3,10 @@ name: Plugin Artifact for PR on: pull_request: paths: - - 'plugins/*/*.php' - - 'plugins/*/*.js' - - 'plugins/*/*.css' - - 'plugins/*/*.json' + - 'plugins/*/**.php' + - 'plugins/*/**.js' + - 'plugins/*/**.css' + - 'plugins/*/**.json' jobs: create-plugin-artifact: