Skip to content

Commit 3dbdb58

Browse files
authored
fix(workflows): fix basename test, pin tool versions, fix fallbacks
1 parent 56abc69 commit 3dbdb58

2 files changed

Lines changed: 39 additions & 29 deletions

File tree

.github/workflows/export-audit.lock.yml

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/export-audit.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,19 @@ steps:
7373
run: |
7474
{
7575
echo "UNUSED_EXPORTS<<EOF"
76-
npm install -g ts-prune 2>/dev/null | tail -5
77-
ts-prune 2>/dev/null | grep -v "\.test\.ts" | head -40 || \
76+
npm install -g ts-prune@0.10.3 2>&1 | tail -5
77+
if command -v ts-prune >/dev/null 2>&1; then
78+
ts-prune | grep -v "\.test\.ts" | head -40
79+
else
80+
echo "ts-prune unavailable, falling back to grep analysis"
7881
grep -rn "^export " src/ --include="*.ts" | grep -v "\.test\.ts" | \
79-
while IFS=: read -r file line rest; do
80-
name=$(echo "$rest" | sed -n 's/.*export \(function\|class\|const\|type\|interface\|enum\) \([a-zA-Z_][a-zA-Z0-9_]*\).*/\2/p')
81-
[ -z "$name" ] && continue
82-
count=$(grep -rwn "${name}" src/ --include="*.ts" 2>/dev/null | grep -v "^${file}:" | wc -l)
83-
[ "$count" -eq 0 ] && echo "UNUSED: $name ($file:$line)"
84-
done | head -30
82+
while IFS=: read -r file line rest; do
83+
name=$(echo "$rest" | sed -n 's/.*export \(function\|class\|const\|type\|interface\|enum\) \([a-zA-Z_][a-zA-Z0-9_]*\).*/\2/p')
84+
[ -z "$name" ] && continue
85+
count=$(grep -rwn "${name}" src/ --include="*.ts" 2>/dev/null | grep -v "^${file}:" | wc -l)
86+
[ "$count" -eq 0 ] && echo "UNUSED: $name ($file:$line)"
87+
done | head -30
88+
fi
8589
echo "EOF"
8690
} >> "$GITHUB_OUTPUT"
8791
@@ -90,8 +94,12 @@ steps:
9094
run: |
9195
{
9296
echo "CIRCULAR_DEPS<<EOF"
93-
npm install -g madge 2>/dev/null | tail -5
94-
madge --circular src/ 2>/dev/null | head -20 || echo "No circular deps detected"
97+
npm install -g madge@8.0.0 2>&1 | tail -5
98+
if command -v madge >/dev/null 2>&1; then
99+
madge --circular src/ 2>&1 | head -20
100+
else
101+
echo "madge unavailable, cannot check circular deps"
102+
fi
95103
echo "EOF"
96104
} >> "$GITHUB_OUTPUT"
97105
@@ -107,8 +115,9 @@ steps:
107115
grep -v "^[A-Z]" | head -20
108116
echo "=== api-proxy provider exports ==="
109117
for f in containers/api-proxy/providers/*.js; do
110-
[ -f "$f" ] && basename "$f" != "index.js" || continue
111-
echo "--- $(basename $f) ---"
118+
[ -f "$f" ] || continue
119+
[ "$(basename "$f")" = "index.js" ] && continue
120+
echo "--- $(basename "$f") ---"
112121
grep -n "^module\.exports\|^exports\." "$f" | head -3
113122
done
114123
echo "EOF"
@@ -196,7 +205,8 @@ The `containers/api-proxy/providers/` modules should follow the provider adapter
196205
```bash
197206
echo "=== api-proxy/providers: check export consistency ==="
198207
for f in containers/api-proxy/providers/*.js; do
199-
[ -f "$f" ] && basename "$f" != "index.js" || continue
208+
[ -f "$f" ] || continue
209+
[ "$(basename "$f")" = "index.js" ] && continue
200210
echo "--- $f ---"
201211
grep -n "^module\.exports\|^exports\." "$f" | head -5
202212
done | head -50

0 commit comments

Comments
 (0)