Skip to content

Commit e3344bd

Browse files
mydeaclaude
andcommitted
fix(ci): Fix Playwright browser path and git config in container
GHA overrides HOME=/github/home inside containers, so browsers installed under /home/runner/.cache weren't found at runtime. Fix by: - Setting PLAYWRIGHT_BROWSERS_PATH=/opt/pw-browsers (fixed, HOME-independent) - Using system-wide git config for safe.directory (works with any HOME) - Removing HOME env overrides from all workflow container configs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9b41b8b commit e3344bd

4 files changed

Lines changed: 8 additions & 20 deletions

File tree

.github/docker/playwright.Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ RUN sudo curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION%%.*}.x | sud
2020
sudo npm install -g yarn@${YARN_VERSION}
2121

2222
# Install Playwright browsers and their OS-level dependencies.
23-
# `--with-deps` installs required system libraries (libglib, libatk, libnss, etc.).
24-
RUN sudo npx playwright@${PLAYWRIGHT_VERSION} install chromium webkit firefox --with-deps
23+
# Use a fixed path so browsers are found regardless of HOME at runtime
24+
# (GHA sets HOME=/github/home inside containers, not /home/runner).
25+
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/pw-browsers
26+
RUN sudo mkdir -p /opt/pw-browsers && \
27+
sudo npx playwright@${PLAYWRIGHT_VERSION} install chromium webkit firefox --with-deps
2528

26-
# Mark GitHub Actions workspace as safe for git.
27-
# The container may run with a different workspace owner,
28-
# causing "dubious ownership" errors in git operations (e.g. rollup build).
29-
RUN git config --global --add safe.directory '*'
29+
# Mark GitHub Actions workspace as safe for git (system-wide config so it
30+
# works regardless of HOME, which GHA overrides to /github/home).
31+
RUN sudo git config --system --add safe.directory '*'

.github/workflows/build.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,6 @@ jobs:
502502
username: ${{ github.actor }}
503503
password: ${{ secrets.GITHUB_TOKEN }}
504504
options: --ipc=host
505-
env:
506-
HOME: /home/runner
507505
timeout-minutes: 25
508506
strategy:
509507
fail-fast: false
@@ -608,8 +606,6 @@ jobs:
608606
username: ${{ github.actor }}
609607
password: ${{ secrets.GITHUB_TOKEN }}
610608
options: --ipc=host
611-
env:
612-
HOME: /home/runner
613609
timeout-minutes: 15
614610
strategy:
615611
fail-fast: false
@@ -804,8 +800,6 @@ jobs:
804800
username: ${{ github.actor }}
805801
password: ${{ secrets.GITHUB_TOKEN }}
806802
options: --ipc=host
807-
env:
808-
HOME: /home/runner
809803
timeout-minutes: 15
810804
strategy:
811805
fail-fast: false
@@ -910,8 +904,6 @@ jobs:
910904
username: ${{ github.actor }}
911905
password: ${{ secrets.GITHUB_TOKEN }}
912906
options: --ipc=host
913-
env:
914-
HOME: /home/runner
915907
timeout-minutes: 15
916908
env:
917909
# We just use a dummy DSN here, only send to the tunnel anyhow
@@ -1044,8 +1036,6 @@ jobs:
10441036
username: ${{ github.actor }}
10451037
password: ${{ secrets.GITHUB_TOKEN }}
10461038
options: --ipc=host
1047-
env:
1048-
HOME: /home/runner
10491039
timeout-minutes: 15
10501040
env:
10511041
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}

.github/workflows/canary.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ jobs:
7878
username: ${{ github.actor }}
7979
password: ${{ secrets.GITHUB_TOKEN }}
8080
options: --ipc=host
81-
env:
82-
HOME: /home/runner
8381
timeout-minutes: 20
8482
env:
8583
# We just use a dummy DSN here, only send to the tunnel anyhow

.github/workflows/flaky-test-detector.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ jobs:
4646
username: ${{ github.actor }}
4747
password: ${{ secrets.GITHUB_TOKEN }}
4848
options: --ipc=host
49-
env:
50-
HOME: /home/runner
5149
timeout-minutes: 60
5250
name: 'Check tests for flakiness'
5351
# Also skip if PR is from master -> develop

0 commit comments

Comments
 (0)