1212 matrix :
1313 os : [ubuntu-latest, macOS-latest, windows-latest]
1414 node-version : [18.13.0, 20, 22]
15-
16- # When not on main, exclude non-latest node version and macOS/Windows
1715 isMain :
1816 - ${{ github.base_ref == 'main' }}
1917 exclude :
@@ -24,44 +22,74 @@ jobs:
2422 runs-on : ${{ matrix.os }}
2523
2624 steps :
27- - name : Set OS environment variable
28- run : echo "__E2E_WORKFLOW_OS__=${{ matrix.os }}" >> $GITHUB_ENV
29-
3025 - name : Checkout Repo
3126 uses : actions/checkout@v4
3227
28+ - name : Check if only docs changed
29+ id : docs-check
30+ shell : bash
31+ run : |
32+ # Fetch the base branch
33+ git fetch origin ${{ github.event.pull_request.base.ref }}
34+
35+ # Get list of changed files
36+ CHANGED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }})
37+
38+ # Check if any changed files are outside sites/docs/
39+ NON_DOCS_CHANGES=$(echo "$CHANGED_FILES" | grep -vE '^sites/docs/' || true)
40+
41+ if [ -z "$NON_DOCS_CHANGES" ]; then
42+ echo "only_docs=true" >> "$GITHUB_OUTPUT"
43+ echo "Skipping e2e tests because only docs were changed."
44+ else
45+ echo "only_docs=false" >> "$GITHUB_OUTPUT"
46+ fi
47+
48+ - name : Set OS environment variable
49+ if : steps.docs-check.outputs.only_docs != 'true'
50+ run : echo "__E2E_WORKFLOW_OS__=${{ matrix.os }}" >> $GITHUB_ENV
51+
3352 - name : Action Setup (pnpm)
53+ if : steps.docs-check.outputs.only_docs != 'true'
3454 uses : pnpm/action-setup@v4
3555
3656 - name : Setup Node
57+ if : steps.docs-check.outputs.only_docs != 'true'
3758 uses : actions/setup-node@v4
3859 with :
3960 node-version : ${{ matrix.node-version }}
4061 cache : pnpm
4162
4263 - name : Install dependencies
64+ if : steps.docs-check.outputs.only_docs != 'true'
4365 run : pnpm install --frozen-lockfile
4466
4567 - name : Install Playwright and browsers
68+ if : steps.docs-check.outputs.only_docs != 'true'
4669 run : pnpm playwright install --with-deps
4770
4871 - name : Run setup
72+ if : steps.docs-check.outputs.only_docs != 'true'
4973 run : pnpm --filter "./e2e/*" run --if-present setup
5074
5175 - name : Run sources
76+ if : steps.docs-check.outputs.only_docs != 'true'
5277 run : pnpm --filter "./e2e/*" run sources
5378
5479 - name : Run dev mode tests
80+ if : steps.docs-check.outputs.only_docs != 'true'
5581 run : pnpm --filter "./e2e/*" --sequential run test:dev
5682
5783 - name : Build
84+ if : steps.docs-check.outputs.only_docs != 'true'
5885 run : pnpm --filter "./e2e/*" run build
5986
6087 - name : Run preview mode tests
88+ if : steps.docs-check.outputs.only_docs != 'true'
6189 run : pnpm --filter "./e2e/*" --sequential run test:preview
6290
6391 - name : Upload Playwright reports
64- if : always()
92+ if : always() && steps.docs-check.outputs.only_docs != 'true'
6593 uses : actions/upload-artifact@v4
6694 with :
6795 name : playwright-report__e2e_${{ matrix.os }}_node-${{ matrix.node-version }}
0 commit comments