From 4c18fd08ff3a1d3cc97a08266e00445ad3334433 Mon Sep 17 00:00:00 2001 From: Nicolas Lemoine Date: Thu, 14 Nov 2024 15:53:50 +0100 Subject: [PATCH] feat: Get PHP version from .php-version file if exists --- .github/workflows/composer-update.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/composer-update.yml b/.github/workflows/composer-update.yml index 05bf782..9edb28f 100644 --- a/.github/workflows/composer-update.yml +++ b/.github/workflows/composer-update.yml @@ -34,10 +34,21 @@ jobs: fetch-depth: 0 ref: main + # Set PHP version as an environment variable + - name: Set PHP version + run: | + if [ -f .php-version ]; then + CURRENT_PHP_VERSION=$(cat .php-version) + else + CURRENT_PHP_VERSION=${{ inputs.PHP_VERSION }} + fi + + echo "PHP_VERSION=$CURRENT_PHP_VERSION" >> "$GITHUB_ENV" + - name: Composer setup uses: Humanoidfr/humanoid-github-workflows/.github/actions/composer@main with: - PHP_VERSION: ${{ inputs.PHP_VERSION }} + PHP_VERSION: ${{ env.PHP_VERSION }} COMPOSER_CONFIG: ${{ vars.COMPOSER_CONFIG_JSON }} INSTALL_AND_CACHE: false