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/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/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index e656bd22..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: @@ -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..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: @@ -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/create-release-branch.yml b/.github/workflows/create-release-branch.yml index c2759e8a..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 dd6c6986..6e622d81 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -13,15 +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/**" + - 'plugins/*/**.php' + - 'plugins/*/**.js' + - 'plugins/*/**.css' + - 'plugins/*/**.json' jobs: detect-plugin: @@ -37,7 +40,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 diff --git a/.github/workflows/plugin-artifact-for-pr.yml b/.github/workflows/plugin-artifact-for-pr.yml index 657dc279..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: 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 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 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'; }