Skip to content

Commit 6f856ee

Browse files
authored
Add Board Header Check Action (#2519)
* Add action to check board headers when modified * Fix invalid escape warning * Check for more board header errors before exiting script * Also run when action file changes * Add back newline at end of check_all_board_headers.sh * Remove python install step * `e.__str__()` -> `str(e)`
1 parent 8fb131a commit 6f856ee

File tree

7 files changed

+121
-60
lines changed

7 files changed

+121
-60
lines changed

.github/workflows/check_board.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Check Board Headers
2+
3+
on:
4+
push:
5+
paths:
6+
- 'src/boards/include/boards/**'
7+
- 'tools/check_board_header.py'
8+
- 'tools/check_all_board_headers.sh'
9+
- '.github/workflows/check_board.yml'
10+
pull_request:
11+
paths:
12+
- 'src/boards/include/boards/**'
13+
- 'tools/check_board_header.py'
14+
- 'tools/check_all_board_headers.sh'
15+
- '.github/workflows/check_board.yml'
16+
17+
jobs:
18+
check-board-headers:
19+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Check Board Headers
26+
run: |
27+
tools/check_all_board_headers.sh

tools/check_all_board_headers.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#!/bin/bash
2+
3+
EXIT_CODE=0
4+
25
for HEADER in src/boards/include/boards/*.h; do
36
tools/check_board_header.py $HEADER
47
if [[ $? -ne 0 ]]; then
5-
break
8+
EXIT_CODE=1
69
fi
710
done
11+
12+
exit $EXIT_CODE

tools/check_board_header.py

Lines changed: 84 additions & 55 deletions
Large diffs are not rendered by default.

tools/extract_build_defines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# Python <3.11 doesn't have ExceptionGroup, so define a simple one
2929
class ExceptionGroup(Exception):
3030
def __init__(self, message, errors):
31-
message += "\n" + "\n".join(e.__str__() for e in errors)
31+
message += "\n" + "\n".join(str(e) for e in errors)
3232
super().__init__(message)
3333

3434
logger = logging.getLogger(__name__)

tools/extract_cmake_configs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# Python <3.11 doesn't have ExceptionGroup, so define a simple one
2929
class ExceptionGroup(Exception):
3030
def __init__(self, message, errors):
31-
message += "\n" + "\n".join(e.__str__() for e in errors)
31+
message += "\n" + "\n".join(str(e) for e in errors)
3232
super().__init__(message)
3333

3434
logger = logging.getLogger(__name__)

tools/extract_cmake_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# Python <3.11 doesn't have ExceptionGroup, so define a simple one
2727
class ExceptionGroup(Exception):
2828
def __init__(self, message, errors):
29-
message += "\n" + "\n".join(e.__str__() for e in errors)
29+
message += "\n" + "\n".join(str(e) for e in errors)
3030
super().__init__(message)
3131

3232
logger = logging.getLogger(__name__)

tools/extract_configs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# Python <3.11 doesn't have ExceptionGroup, so define a simple one
2929
class ExceptionGroup(Exception):
3030
def __init__(self, message, errors):
31-
message += "\n" + "\n".join(e.__str__() for e in errors)
31+
message += "\n" + "\n".join(str(e) for e in errors)
3232
super().__init__(message)
3333

3434
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)