Skip to content

Commit 63a6d5d

Browse files
authored
Update docs-quality.yml
1 parent 6a481c5 commit 63a6d5d

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

.github/workflows/docs-quality.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,24 @@ jobs:
5252
ItsContraction
5353
)
5454
ONLY_ARG="--only $(IFS=,; echo "${ONLY_RULES[*]}")"
55+
mdxtmp="$(mktemp -d)"
5556
out="$(mktemp)"
5657
total=0
5758
bad=0
5859
while IFS= read -r -d '' file; do
5960
total=$((total+1))
61+
case "$file" in
62+
*.mdx)
63+
target="$mdxtmp/${file}.md"
64+
mkdir -p "$(dirname "$target")"
65+
cp "$file" "$target"
66+
;;
67+
*)
68+
target="$file"
69+
;;
70+
esac
6071
echo "::group::$file"
61-
if harper-cli lint $ONLY_ARG "$file" 2>&1 | tee -a "$out"; then
72+
if harper-cli lint $ONLY_ARG "$target" 2>&1 | tee -a "$out"; then
6273
:
6374
else
6475
bad=$((bad+1))
@@ -94,8 +105,19 @@ jobs:
94105
ItsContraction
95106
)
96107
ONLY_ARG="--only $(IFS=,; echo "${ONLY_RULES[*]}")"
108+
mdxtmp="$(mktemp -d)"
97109
while IFS= read -r -d '' file; do
98-
if json_out="$(harper-cli lint $ONLY_ARG --format json "$file" 2>/dev/null)"; then
110+
case "$file" in
111+
*.mdx)
112+
target="$mdxtmp/${file}.md"
113+
mkdir -p "$(dirname "$target")"
114+
cp "$file" "$target"
115+
;;
116+
*)
117+
target="$file"
118+
;;
119+
esac
120+
if json_out="$(harper-cli lint $ONLY_ARG --format json "$target" 2>/dev/null)"; then
99121
:
100122
else
101123
printf '%s' "$json_out" | FILE="$file" python3 -c "import json,sys,os;d=json.load(sys.stdin);fp=os.environ['FILE'];esc=lambda s: s.replace('%','%25').replace('\r','%0D').replace('\n','%0A');[print('::warning file='+esc(fp)+',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

0 commit comments

Comments
 (0)