Skip to content

Commit 73b09a1

Browse files
committed
Handle non-zero Vale exit status
1 parent 61b78c4 commit 73b09a1

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/developer-guide-docs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,15 @@ jobs:
189189
REPORT_DIR="build/developer-guide/reports"
190190
REPORT_FILE="${REPORT_DIR}/vale-report.json"
191191
mkdir -p "$REPORT_DIR"
192+
set +e
192193
vale --config docs/developer-guide/.vale.ini --output=JSON docs/developer-guide > "$REPORT_FILE"
194+
STATUS=$?
195+
set -e
193196
echo "VALE_REPORT=$REPORT_FILE" >> "$GITHUB_ENV"
197+
echo "VALE_STATUS=$STATUS" >> "$GITHUB_ENV"
198+
if [ "$STATUS" -ne 0 ]; then
199+
echo "Vale exited with status $STATUS" >&2
200+
fi
194201
195202
- name: Check for unused developer guide images
196203
run: |
@@ -216,6 +223,7 @@ jobs:
216223
run: |
217224
python3 scripts/developer-guide/summarize_reports.py vale \
218225
--report "${VALE_REPORT}" \
226+
--status "${VALE_STATUS:-0}" \
219227
--output "${GITHUB_OUTPUT}"
220228
221229
- name: Summarize unused image findings

scripts/developer-guide/summarize_reports.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def summarize_asciidoc(report: Path, status: str, summary_key: str, output: Path
3232
write_output([f"{summary_key}={summary}"], output)
3333

3434

35-
def summarize_vale(report: Path, summary_key: str, output: Path | None) -> None:
35+
def summarize_vale(
36+
report: Path, status: str, summary_key: str, output: Path | None
37+
) -> None:
3638
alerts: list[dict[str, object]] = []
3739
if report.is_file():
3840
try:
@@ -61,6 +63,10 @@ def summarize_vale(report: Path, summary_key: str, output: Path | None) -> None:
6163
else:
6264
summary = "No alerts found"
6365

66+
status = status.strip()
67+
if status and status != "0":
68+
summary += f" (exit code {status})"
69+
6470
write_output([f"{summary_key}={summary}"], output)
6571

6672

@@ -124,6 +130,7 @@ def parse_args() -> argparse.Namespace:
124130
help="Summarize Vale style linter results.",
125131
)
126132
vale_parser.add_argument("--report", type=Path, required=True)
133+
vale_parser.add_argument("--status", default="0")
127134
vale_parser.add_argument("--summary-key", default="summary")
128135

129136
unused_parser = subparsers.add_parser(
@@ -145,7 +152,7 @@ def main() -> None:
145152
if command == "ascii":
146153
summarize_asciidoc(args.report, args.status, args.summary_key, output)
147154
elif command == "vale":
148-
summarize_vale(args.report, args.summary_key, output)
155+
summarize_vale(args.report, args.status, args.summary_key, output)
149156
elif command == "unused-images":
150157
summarize_unused_images(
151158
args.report,

0 commit comments

Comments
 (0)