Skip to content

Commit 4a14e73

Browse files
committed
Fix pr-format CI to fail on formatting changes
Add git diff --exit-code step to fail the check when formatters produce changes. Previously reviewdog only posted suggestions without failing the workflow.
1 parent c578ac0 commit 4a14e73

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/pr-format.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ jobs:
4747
- name: Run generate_opcode_metadata.py
4848
run: python scripts/generate_opcode_metadata.py
4949

50+
- name: Check for formatting changes
51+
run: |
52+
if ! git diff --exit-code; then
53+
echo "::error::Formatting changes detected. Please run 'cargo fmt --all', 'ruff format', and 'ruff check --select I --fix' locally."
54+
exit 1
55+
fi
56+
5057
- name: Post formatting suggestions
58+
if: failure()
5159
uses: reviewdog/action-suggester@v1
5260
with:
5361
tool_name: auto-format

0 commit comments

Comments
 (0)