Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Kovalenko committed Jun 18, 2024
1 parent 5ff10f1 commit 7828f1a
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,32 @@ 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
jobs:
set-env:
runs-on: ubuntu-latest
outputs:
should-run-pr: ${{ steps.set-env.outputs.should-run-pr }}
should-run-push: ${{ steps.set-env.outputs.should-run-push }}
steps:
- name: Set should-run for PR
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-pr::true"
else
echo "::set-output name=should-run-pr::false"
fi
if [ "${{ github.event_name }}" = "push" ] && [ -n "${{ secrets.CHROMATIC_PROJECT_TOKEN }}" ]; then
echo "::set-output name=should-run-push::true"
else
echo "::set-output name=should-run-push::false"
fi
test-visual-pr:
runs-on: ubuntu-latest
needs:
[test-format, test-lint, test-stylelint, test-tsconfig, set-env-visual-pr]
if: needs.set-env.outputs.should-run == 'true'
needs: [test-format, test-lint, test-stylelint, test-tsconfig, set-env]
if: needs.set-env.outputs.should-run-pr == 'true'
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -135,8 +141,8 @@ jobs:

test-visual-dev:
runs-on: ubuntu-latest
needs: [test-format, test-lint, test-stylelint, test-tsconfig]
if: ${{ github.event_name == 'push' }}
needs: [test-format, test-lint, test-stylelint, test-tsconfig, set-env]
if: needs.set-env.outputs.should-run-push == 'true'
steps:
- uses: actions/checkout@v3
with:
Expand Down

0 comments on commit 7828f1a

Please sign in to comment.