Skip to content

Commit 536c324

Browse files
Only run tests, when they do exist
1 parent 7404f30 commit 536c324

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.github/workflows/build-and-publish.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,17 @@ jobs:
3434
- name: Install Dependencies
3535
run: npm ci
3636

37+
- name: Check if tests exist
38+
id: check_tests
39+
run: |
40+
if grep -q '"test":' package.json && [ "$(npm pkg get scripts.test)" != '{}' ] && [ "$(npm pkg get scripts.test)" != 'null' ]; then
41+
echo "has_tests=true" >> $GITHUB_OUTPUT
42+
else
43+
echo "has_tests=false" >> $GITHUB_OUTPUT
44+
fi
45+
3746
- name: Run tests
47+
if: steps.check_tests.outputs.has_tests == 'true'
3848
run: npm test
3949

4050
build_and_publish:

0 commit comments

Comments
 (0)