Skip to content

Commit

Permalink
Github actions fail on unformatted code.
Browse files Browse the repository at this point in the history
  • Loading branch information
james-choncholas committed Sep 10, 2024
1 parent be6c10d commit 61ff091
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/formatter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check formatting

on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
formatter:
name: Check formatting of Python, C++, and Bazel files.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build wheel
shell: bash
run: |
bazelisk run //:bazel_formatter
bazelisk run //:python_formatter
bazelisk run //:clang_formatter
- name: Check if any files have changed
id: changes
uses: UnicornGlobal/has-changes-action@v1

- name: Error if code has not been formatted
if: steps.changes.outputs.changed == 1
run: |
echo "Code has not been formatted. Please run the formatters as described by the README."
return 1

0 comments on commit 61ff091

Please sign in to comment.