From c5458fee11c25e066a2edfefa4c1c70fd1b196be Mon Sep 17 00:00:00 2001 From: Erika Gili Date: Mon, 27 Jan 2025 15:47:03 +0100 Subject: [PATCH] Refactor env variables --- .github/workflows/test-playwright.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-playwright.yml b/.github/workflows/test-playwright.yml index 412f0dfc..8baa913d 100644 --- a/.github/workflows/test-playwright.yml +++ b/.github/workflows/test-playwright.yml @@ -81,9 +81,7 @@ jobs: env: COMPOSER_AUTH: '${{ secrets.COMPOSER_AUTH_JSON }}' NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }} - GITHUB_USER_EMAIL: ${{ secrets.GITHUB_USER_EMAIL }} - GITHUB_USER_NAME: ${{ secrets.GITHUB_USER_NAME }} - GITHUB_USER_SSH_KEY: ${{ secrets.GITHUB_USER_SSH_KEY }} + PHP_CHECK: false steps: - name: Checkout uses: actions/checkout@v4 @@ -100,19 +98,25 @@ jobs: .forEach(envVar => core.exportVariable(envVar.name, envVar.value)); - name: Set up SSH - if: ${{ env.GITHUB_USER_SSH_KEY != '' }} + if: ${{ secrets.GITHUB_USER_SSH_KEY != '' }} uses: webfactory/ssh-agent@v0.9.0 with: - ssh-private-key: ${{ env.GITHUB_USER_SSH_KEY }} + ssh-private-key: ${{ secrets.GITHUB_USER_SSH_KEY }} - name: Set up Git - if: ${{ env.GITHUB_USER_EMAIL != '' && env.GITHUB_USER_NAME != '' }} + if: ${{ secrets.GITHUB_USER_EMAIL != '' && secrets.GITHUB_USER_NAME != '' }} run: | - git config --global user.email "${{ env.GITHUB_USER_EMAIL }}" - git config --global user.name "${{ env.GITHUB_USER_NAME }}" + git config --global user.email "${{ secrets.GITHUB_USER_EMAIL }}" + git config --global user.name "${{ secrets.GITHUB_USER_NAME }}" + + - name: Check if PHP installation is needed + run: | + if [ "${{ hashFiles('composer.json') }}" != '' && "${{inputs.PHP_VERSION }}" != '' ]; then + echo "PHP_CHECK=true" >> $GITHUB_ENV + fi - name: Set up PHP - if: ${{ hashFiles('composer.json') != '' && inputs.PHP_VERSION && inputs.PHP_VERSION != '' }} # move to env var + if: ${{ env.PHP_CHECK == 'true' }} uses: shivammathur/setup-php@v2 with: php-version: ${{ inputs.PHP_VERSION }} @@ -120,7 +124,7 @@ jobs: coverage: none - name: Install Composer dependencies - if: ${{ hashFiles('composer.json') != '' && inputs.PHP_VERSION && inputs.PHP_VERSION != '' }} + if: ${{ env.PHP_CHECK == 'true' }} uses: ramsey/composer-install@v3 with: composer-options: '--prefer-dist'