4747 - name : Checkout
4848 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4949
50+ - name : Fetch main
51+ run : git fetch origin main # To allow check-should-run-type-checks to get the diff from main
52+
5053 - name : Install pnpm
5154 uses : pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
5255
@@ -63,15 +66,31 @@ jobs:
6366 - name : Build src
6467 run : pnpm run build:min
6568
69+ # NOTE: To include this workflow in the branch protection rule status check,
70+ # skip each steps instead of skipping the entire workflow with paths-ignore.
71+ - name : Check diff
72+ id : check_diff_type
73+ run : pnpm exec check-should-run-type-checks
74+
6675 - name : Install Playwright Browsers
67- if : matrix.command == 'test:browser'
76+ if : steps.check_diff_type.outputs.should_run == 'true' && matrix.command == 'test:browser'
6877 run : pnpm exec playwright install chromium
6978
7079 - name : Run "${{ matrix.command }}"
80+ if : steps.check_diff_type.outputs.should_run == 'true' && matrix.command != 'test:browser'
7181 run : pnpm run ${{ matrix.command }}
7282
83+ # Source - https://stackoverflow.com/a/71583518
84+ - name : Run 'test:browser' with retry
85+ if : steps.check_diff_type.outputs.should_run == 'true' && matrix.command == 'test:browser'
86+ uses : nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
87+ with :
88+ timeout_minutes : 5
89+ max_attempts : 3
90+ command : pnpm run ${{ matrix.command }}
91+
7392 - name : Upload coverage reports to Codecov
74- if : matrix.command == 'test:cov'
93+ if : steps.check_diff_type.outputs.should_run == 'true' && matrix.command == 'test:cov'
7594 uses : codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
7695 with :
7796 fail_ci_if_error : true
0 commit comments