Skip to content

Commit d4a4364

Browse files
authored
Workflow Update
1 parent b12e2dd commit d4a4364

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,25 @@ jobs:
3333
php-version: '8.0'
3434
tools: composer:v2, phpcs
3535

36+
- name: Check for package-lock.json
37+
id: check-lockfile
38+
run: |
39+
if [ -f "package-lock.json" ]; then
40+
echo "lockfile_exists=true" >> $GITHUB_OUTPUT
41+
else
42+
echo "lockfile_exists=false" >> $GITHUB_OUTPUT
43+
echo "package-lock.json not found. Caching will be skipped."
44+
fi
45+
3646
- name: Setup Node.js
3747
uses: actions/setup-node@v4
3848
with:
3949
node-version: '16'
40-
# Only use cache if package-lock.json exists
41-
cache: npm
42-
cache-dependency-path: '**/package-lock.json'
50+
# Use conditional caching based on package-lock.json existence
51+
cache: ${{ steps.check-lockfile.outputs.lockfile_exists == 'true' && 'npm' || '' }}
52+
cache-dependency-path: |
53+
**/package-lock.json
54+
!**/node_modules/
4355
4456
- name: Install PHP dependencies
4557
run: |
@@ -85,13 +97,25 @@ jobs:
8597
- name: Checkout code
8698
uses: actions/checkout@v4
8799

100+
- name: Check for package-lock.json in build
101+
id: check-lockfile-build
102+
run: |
103+
if [ -f "package-lock.json" ]; then
104+
echo "lockfile_exists=true" >> $GITHUB_OUTPUT
105+
else
106+
echo "lockfile_exists=false" >> $GITHUB_OUTPUT
107+
echo "package-lock.json not found. Caching will be skipped."
108+
fi
109+
88110
- name: Setup Node.js
89111
uses: actions/setup-node@v4
90112
with:
91113
node-version: '16'
92-
# Only use cache if package-lock.json exists
93-
cache: npm
94-
cache-dependency-path: '**/package-lock.json'
114+
# Use conditional caching based on package-lock.json existence
115+
cache: ${{ steps.check-lockfile-build.outputs.lockfile_exists == 'true' && 'npm' || '' }}
116+
cache-dependency-path: |
117+
**/package-lock.json
118+
!**/node_modules/
95119
96120
- name: Setup PHP
97121
uses: shivammathur/setup-php@v2

0 commit comments

Comments
 (0)