File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6868 sys.exit(1 if issues and not allow_failure else 0)
6969 PY
7070
71- heading-case :
72- runs-on : ubuntu-latest
73- steps :
74- - uses : actions/checkout@v6
75- - run : |
76- python check_heading_case.py docs src/pages || {
77- if [ "$ALLOW_FAILURE" = "true" ]; then
78- exit 0
79- fi
80- exit 1
81- } with:
82- path: |
83- ~/.cargo/bin
84- ~/.cargo/registry
85- ~/.cargo/git
86- key: ${{ runner.os }}-cargo-harper
87- restore-keys: ${{ runner.os }}-cargo-harper
88- - run : |
89- command -v harper-cli >/dev/null 2>&1 || \
90- cargo install --git https://github.com/Automattic/harper \
91- --tag v2.1.0 \
92- harper-cli --locked
93- - run : |
94- find docs src/pages -type f \( -name "*.md" -o -name "*.mdx" \) -print0 | \
95- xargs -0 harper-cli lint --format json > harper-report.json || true
96- - run : |
97- python - <<'PY'
98- import json
99- import os
100- import sys
101-
102- with open("harper-report.json", encoding="utf-8") as f:
103- reports = json.load(f)
104-
105- ALLOWED_KINDS = {"Grammar", "Repetition"}
106- issues = []
107-
108- for report in reports:
109- file = report.get("file")
110- for lint in report.get("lints", []):
111- if lint.get("kind") not in ALLOWED_KINDS:
112- continue
113- line = lint.get("line")
114- message = lint.get("message")
115- print(f"::error file={file},line={line}::{message}")
116- issues.append(lint)
117-
118- print(f"{len(issues)} grammar/repetition issue(s) found.")
119-
120- allow_failure = os.environ.get("ALLOW_FAILURE") == "true"
121- sys.exit(1 if issues and not allow_failure else 0)
122- PY
123-
12471 heading-case :
12572 runs-on : ubuntu-latest
12673 steps :
You can’t perform that action at this time.
0 commit comments