From 1e9945af9d279b78da4bdde8a2e7f6440cca075f Mon Sep 17 00:00:00 2001 From: deepakpathania Date: Tue, 12 Sep 2023 16:02:56 +0530 Subject: [PATCH] Extract minimum supported PHP version from plugin file for GH actions --- .github/actions/setup-repo/action.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup-repo/action.yml b/.github/actions/setup-repo/action.yml index 28741b60920..5c103662500 100644 --- a/.github/actions/setup-repo/action.yml +++ b/.github/actions/setup-repo/action.yml @@ -12,18 +12,26 @@ runs: - name: "Setup Node" uses: actions/setup-node@v3 with: - node-version-file: '.nvmrc' - cache: 'npm' + node-version-file: ".nvmrc" + cache: "npm" - name: "Enable composer dependencies caching" uses: actions/cache@v3 with: path: ~/.cache/composer/ key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} - + + - name: "Get minimum PHP version" + id: get_min_php_version + run: | + MIN_PHP_VERSION=$(sed -n 's/.*PHP: //p' woocommerce-payments.php) + echo "MIN_PHP_VERSION=$MIN_PHP_VERSION" >> $GITHUB_OUTPUT + - name: "Setup PHP" uses: shivammathur/setup-php@v2 + env: + MIN_PHP_VERSION: ${{ steps.get_min_php_version.outputs.MIN_PHP_VERSION }} with: - php-version: ${{ inputs.php-version }} + php-version: $MIN_PHP_VERSION tools: composer coverage: none