From eb24450b426238ae0eab3fd131a90ee8804055f2 Mon Sep 17 00:00:00 2001 From: Alexander Kovalenko Date: Tue, 18 Jun 2024 18:24:38 +0300 Subject: [PATCH] Fix. --- .github/workflows/test.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 73e441e6..b690f277 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -100,10 +100,25 @@ jobs: affectedCmd: npx nx affected:test isDev: ${{ env.IS_DEV }} + set-env-visual-pr: + runs-on: ubuntu-latest + outputs: + should-run: ${{ steps.set-env.outputs.should-run }} + steps: + - name: Set should-run + id: set-env + run: | + echo "CHROMATIC_PROJECT_TOKEN=${{ secrets.CHROMATIC_PROJECT_TOKEN }}" + if [ "${{ github.event_name }}" = "pull_request" ] && [ -n "${{ secrets.CHROMATIC_PROJECT_TOKEN }}" ]; then + echo "::set-output name=should-run::true" + else + echo "::set-output name=should-run::false" + fi + test-visual-pr: runs-on: ubuntu-latest - needs: [test-format, test-lint, test-stylelint, test-tsconfig] - if: github.event_name == 'pull_request' && secrets.CHROMATIC_PROJECT_TOKEN != '' + needs: [test-format, test-lint, test-stylelint, test-tsconfig, set-env-visual-pr] + if: needs.set-env.outputs.should-run == 'true' steps: - uses: actions/checkout@v3 with: @@ -120,11 +135,12 @@ jobs: test-visual-dev: runs-on: ubuntu-latest needs: [test-format, test-lint, test-stylelint, test-tsconfig] - if: github.event_name == 'push' && secrets.CHROMATIC_PROJECT_TOKEN != '' + if: ${{ github.event_name == 'push' }} steps: - uses: actions/checkout@v3 with: ref: ${{ env.GITHUB_REF }} + repository: ${{ env.REPOSITORY }} fetch-depth: 0 - uses: ./.github/actions/init - name: Visual Regression Tests