Skip to content

Commit 573987b

Browse files
authored
Update docs-quality.yml
1 parent 5a9209f commit 573987b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/docs-quality.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,19 @@ jobs:
124124
} >> "$GITHUB_STEP_SUMMARY"
125125
echo "== Harper: $bad/$total files with issues; $titlecase UseTitleCase violations =="
126126
[ "$bad" -eq 0 ]
127+
128+
- name: Annotate PR with Harper warnings
129+
if: always()
130+
run: |
131+
set -uo pipefail
132+
while IFS= read -r -d '' file; do
133+
if json_out="$(harper-cli lint $ONLY_ARG --format json "$file" 2>/dev/null)"; then
134+
:
135+
else
136+
printf '%s' "$json_out" | python3 -c "import json,sys;d=json.load(sys.stdin);esc=lambda s: s.replace('%','%25').replace('\r','%0D').replace('\n','%0A');[print('::warning file='+esc(f.get('file',''))+',line='+str(l.get('line',1))+',col='+str(l.get('column',1))+',title='+esc(l.get('rule','?'))+'::'+esc(l.get('message',''))) for f in d for l in f.get('lints',[])]" || true
137+
fi
138+
done < <(
139+
find docs src/pages \
140+
-type f \( -name "*.md" -o -name "*.mdx" \) \
141+
-print0 2>/dev/null
142+
)

0 commit comments

Comments
 (0)