|
24 | 24 | outputs: |
25 | 25 | plugins: ${{ steps.detect.outputs.plugins }} |
26 | 26 | has-plugins: ${{ steps.detect.outputs.has-plugins }} |
| 27 | + php-version: ${{ steps.detect-php-version.outputs.php-version }} |
27 | 28 | steps: |
28 | 29 | - name: Checkout |
29 | 30 | uses: actions/checkout@v4 |
|
40 | 41 | fi |
41 | 42 |
|
42 | 43 | - name: Detect changed plugins with quality config |
43 | | - id: detect |
| 44 | + id: detect-plugin-slug |
44 | 45 | run: | |
45 | 46 | if [ -z "${{ steps.plugin.outputs.slug }}" ]; then |
46 | 47 | echo "No plugin slug detected" |
|
60 | 61 | echo "has-plugins=false" >> $GITHUB_OUTPUT |
61 | 62 | echo "ℹ️ No phpcs.xml found for plugin: $PLUGIN, skipping quality checks" |
62 | 63 | fi |
| 64 | + - name: Detect changed plugins with quality config |
| 65 | + id: detect-php-version |
| 66 | + run: | |
| 67 | + PLUGIN="${{ steps.plugin.outputs.slug }}" |
| 68 | + PHP_VERSION="7.4" |
| 69 | + if [ -f "plugins/$PLUGIN/composer.json" ]; then |
| 70 | + DETECTED_VERSION=$(jq -r '.require["php"] // empty' plugins/$PLUGIN/composer.json | grep -oE '[0-9]+\.[0-9]+' | head -1) |
| 71 | + if [ -n "$DETECTED_VERSION" ]; then |
| 72 | + PHP_VERSION="$DETECTED_VERSION" |
| 73 | + echo "Detected PHP version $PHP_VERSION from composer.json" |
| 74 | + else |
| 75 | + echo "No PHP version found in composer.json, using default $PHP_VERSION" |
| 76 | + fi |
| 77 | + else |
| 78 | + echo "No composer.json found, using default PHP version $PHP_VERSION" |
| 79 | + fi |
| 80 | + echo "php-version=$PHP_VERSION" >> $GITHUB_OUTPUT |
63 | 81 | quality-checks: |
64 | 82 | needs: detect-plugins |
65 | 83 | if: needs.detect-plugins.outputs.has-plugins == 'true' |
|
77 | 95 | uses: ./.github/actions/code-quality |
78 | 96 | with: |
79 | 97 | working-directory: plugins/${{ matrix.plugin }} |
| 98 | + php-version: ${{ needs.detect-plugins.outputs.php-version }} |
| 99 | + composer-options: '--no-progress --no-suggest' |
0 commit comments