File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 - uses : actions/checkout@v4
2626
2727 - id : read-php-version
28- name : " Read PHP Version"
28+ name : " Read PHP Version in Composer "
2929 shell : bash
3030 working-directory : ${{ inputs.working_directory }}
3131 run : |
4848 echo "No PHP version detected"
4949 exit 0;
5050
51+ - id : read-system-php-version
52+ name : " Read System PHP Version"
53+ shell : bash
54+ if : ${{ steps.read-php-version.outputs.php_version == '' }}
55+ run : |
56+ php_version=$(php -v | head -n 1 | cut -d ' ' -f 2 | cut -d '.' -f 1,2)
57+ echo "No composer.json detected, falling back to system PHP version $php_version"
58+ echo "php_version=$php_version" >> $GITHUB_OUTPUT
59+
60+ - id : decide-php-version
61+ name : " Decide PHP Version"
62+ shell : bash
63+ run : |
64+ echo "Requested PHP Version: ${{ steps.read-php-version.outputs.php_version }}"
65+ echo "System PHP Version: ${{ steps.read-system-php-version.outputs.php_version }}"
66+ if [ "${{ steps.read-php-version.outputs.php_version }}" != "" ] && [ "${{ steps.read-php-version.outputs.php_version }}" != "${{ steps.read-system-php-version.outputs.php_version }}" ]; then
67+ echo "Switching PHP version to ${{ steps.read-php-version.outputs.php_version }}"
68+ else
69+ echo "Keeping system PHP version ${{ steps.read-system-php-version.outputs.php_version }}"
70+ fi
71+
5172 - uses : shivammathur/setup-php@v2
73+ if : ${{ steps.read-system-php-version.outputs.php_version != '' || steps.read-php-version.outputs.php_version != steps.read-system-php-version.outputs.php_version }}
5274 with :
5375 php-version : ${{ steps.read-php-version.outputs.php_version }}
5476 tools : ${{ inputs.php_tools }}
You can’t perform that action at this time.
0 commit comments