|
1 |
| -name: Cpp Code Style Checker |
| 1 | +name: QuIC Organization Repolinter |
2 | 2 |
|
3 |
| -on: [push, pull_request, workflow_dispatch] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ $default-branch ] |
| 6 | + pull_request: |
| 7 | + branches: [ $default-branch ] |
| 8 | + workflow_dispatch: |
4 | 9 |
|
5 | 10 | jobs:
|
6 |
| - cpp-code-style-check: |
| 11 | + repolinter: |
7 | 12 | runs-on: ubuntu-latest
|
8 |
| - |
9 | 13 | steps:
|
10 |
| - - name: Checkout code |
11 |
| - uses: actions/checkout@v4 |
12 |
| - |
13 |
| - - name: Install clang-format |
14 |
| - run: sudo apt install -y clang-format |
15 |
| - |
16 |
| - - name: Setup clang-format configuration |
17 |
| - run: | |
18 |
| - if [ ! -f ./.clang-format ]; then |
19 |
| - echo "No .clang-format found, will use default configuration" |
20 |
| - curl -o .clang-format https://raw.githubusercontent.com/quic-qrb-ros/.github/main/code-style-profiles/.clang-format |
21 |
| - fi |
22 |
| -
|
23 |
| - - name: Check code style |
24 |
| - run: | |
25 |
| - SRC=$(git ls-tree --full-tree -r HEAD | grep -e "\.\(c\|h\|hpp\|cpp\)\$" | cut -f 2) |
26 |
| -
|
27 |
| - echo -e "Check source files: \n$SRC\n" |
28 |
| - clang-format -style=file -i $SRC |
29 |
| -
|
30 |
| - if ! git diff --exit-code; then |
31 |
| - echo -e "\nCode does not match required style !!!" |
32 |
| - echo "Please use clang-format to format your code." |
33 |
| - exit 1 |
34 |
| - else |
35 |
| - echo "All files are properly formatted." |
36 |
| - fi |
| 14 | + - name: Checkout Repo |
| 15 | + uses: actions/checkout@v2 |
| 16 | + - name: Verify repolinter config file is present |
| 17 | + id: check_files |
| 18 | + uses: andstor/file-existence-action@v1 |
| 19 | + with: |
| 20 | + files: "repolint.json" |
| 21 | + - name: Run Repolinter with local repolint.json |
| 22 | + if: steps.check_files.outputs.files_exists == 'true' |
| 23 | + uses: todogroup/repolinter-action@v1 |
| 24 | + with: |
| 25 | + config_file: "repolint.json" |
| 26 | + - name: Run Repolinter with default ruleset |
| 27 | + if: steps.check_files.outputs.files_exists == 'false' |
| 28 | + uses: todogroup/repolinter-action@v1 |
| 29 | + with: |
| 30 | + config_url: "https://raw.githubusercontent.com/quic/.github/main/repolint.json" |
0 commit comments