Skip to content

Commit 8677331

Browse files
committed
fixup! Ensure write access
1 parent 9e4e45e commit 8677331

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/workflows/test-installers.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,14 @@ jobs:
9191
# Add a non-admin sudoer user and switch to it
9292
adduser compass
9393
echo "compass ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
94-
# Make sure the compass user has write access to the workspace
95-
chown -R compass:compass $HOME
96-
ls -la $HOME
94+
# Make sure the compass user has write access to the npm cache and the workspace
95+
NPM_CACHE_PATH=$(npm config get cache)
96+
chown -R compass:compass $NPM_CACHE_PATH $GITHUB_WORKSPACE
97+
# Link the npm cache controlled by the setup-node action into the compass user's cache directory
98+
sudo -u compass ln -s $NPM_CACHE_PATH $(npm config get cache)
9799
# Use a shell which switch to the non-root compass user first
98100
# Using --preserve-env and --preserve-env=PATH to propagate environment variables
99-
shell: sudo --preserve-env=HOME --preserve-env=PATH --preserve-env -u compass bash -x -e {0}
101+
shell: sudo --preserve-env=PATH --preserve-env -u compass bash -x -e {0}
100102
container:
101103
image: rockylinux:9
102104
volumes:

0 commit comments

Comments
 (0)