Refine Lighthouse findings and project detection
pauljd/davidson-ci: Davidson CI / ai-review (push) Successful in 41s
pauljd/davidson-ci: Davidson CI / quality (push) Successful in 1m43s

This commit is contained in:
2026-09-12 20:34:44 +01:00
parent 873e14219c
commit 1aee963ed2
2 changed files with 30 additions and 14 deletions
+22 -13
View File
@@ -1,24 +1,37 @@
#!/bin/bash
set -euo pipefail
echo "================================"
echo " Davidson CI - Project Detection"
echo "================================"
PHP_COUNT=$(find . -type f -name "*.php" \
-not -path "*/vendor/*" | wc -l)
PHP_COUNT=$(find . \
-type f \
-name "*.php" \
-not -path "*/vendor/*" \
-not -path "./.davidson-ci/*" \
| wc -l)
JS_COUNT=$(find . -type f \
JS_COUNT=$(find . \
-type f \
\( -name "*.js" -o -name "*.mjs" -o -name "*.cjs" \) \
-not -path "*/node_modules/*" | wc -l)
-not -path "*/node_modules/*" \
-not -path "./.davidson-ci/*" \
| wc -l)
TS_COUNT=$(find . -type f \
TS_COUNT=$(find . \
-type f \
\( -name "*.ts" -o -name "*.tsx" \) \
-not -path "*/node_modules/*" | wc -l)
-not -path "*/node_modules/*" \
-not -path "./.davidson-ci/*" \
| wc -l)
CSS_COUNT=$(find . -type f -name "*.css" \
-not -path "*/node_modules/*" | wc -l)
CSS_COUNT=$(find . \
-type f \
-name "*.css" \
-not -path "*/node_modules/*" \
-not -path "./.davidson-ci/*" \
| wc -l)
FRONTEND_TYPE="none"
LIGHTHOUSE_ELIGIBLE="false"
@@ -26,11 +39,9 @@ LIGHTHOUSE_ELIGIBLE="false"
if [ -f "./vite.config.js" ] || [ -f "./vite.config.ts" ]; then
FRONTEND_TYPE="vite"
LIGHTHOUSE_ELIGIBLE="true"
elif [ -f "./next.config.js" ] || [ -f "./next.config.mjs" ]; then
FRONTEND_TYPE="next"
LIGHTHOUSE_ELIGIBLE="true"
elif [ -f "./index.html" ]; then
FRONTEND_TYPE="static"
LIGHTHOUSE_ELIGIBLE="true"
@@ -46,13 +57,11 @@ echo "Frontend: $FRONTEND_TYPE"
echo "Lighthouse: $LIGHTHOUSE_ELIGIBLE"
echo
# Make detection results available to later CI steps.
{
echo "DAVIDSON_PHP_COUNT=$PHP_COUNT"
echo "DAVIDSON_JS_COUNT=$JS_COUNT"
echo "DAVIDSON_TS_COUNT=$TS_COUNT"
echo "DAVIDSON_CSS_COUNT=$CSS_COUNT"
echo "DAVIDSON_FRONTEND_TYPE=$FRONTEND_TYPE"
echo "DAVIDSON_LIGHTHOUSE_ELIGIBLE=$LIGHTHOUSE_ELIGIBLE"
} >> "${GITHUB_ENV:-/dev/null}"
+8 -1
View File
@@ -95,6 +95,7 @@ $skipModes = [
'informative',
'manual',
'error',
'numeric',
];
foreach ($data['audits'] ?? [] as $auditId => $audit) {
@@ -113,9 +114,15 @@ foreach ($data['audits'] ?? [] as $auditId => $audit) {
continue;
}
$categories = $auditCategories[$auditId] ?? [];
if ($categories === []) {
continue;
}
$findings[] = [
'id' => $auditId,
'categories' => $auditCategories[$auditId] ?? [],
'categories' => $categories,
'title' => $audit['title'] ?? $auditId,
'problem' => $audit['description'] ?? '',
'impact' => $audit['displayValue'] ?? null,