Skip to content

Commit

Permalink
Update action
Browse files Browse the repository at this point in the history
  • Loading branch information
quic-zhaoyuan committed Nov 14, 2024
1 parent 9cf276e commit 31f5827
Showing 1 changed file with 32 additions and 19 deletions.
51 changes: 32 additions & 19 deletions .github/workflows/quic-organization-repolinter.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
name: QuIC Organization Repolinter
name: Cpp Code Style Checker

on: [push, pull_request, workflow_dispatch]

jobs:
repolinter:
cpp-code-style-check:
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Verify repolinter config file is present
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "repolint.json"
- name: Run Repolinter with local repolint.json
if: steps.check_files.outputs.files_exists == true
uses: todogroup/repolinter-action@v1
with:
config_file: "repolint.json"
- name: Run Repolinter with default ruleset
if: steps.check_files.outputs.files_exists == false
uses: todogroup/repolinter-action@v1
with:
config_url: "https://raw.githubusercontent.com/quic/.github/main/repolint.json"
- name: Checkout code
uses: actions/checkout@v4

- name: Install clang-format
run: sudo apt install -y clang-format

- name: Setup clang-format configuration
run: |
if [ ! -f ./.clang-format ]; then
echo "No .clang-format found, will use default configuration"
curl -o .clang-format https://raw.githubusercontent.com/quic-qrb-ros/.github/main/code-style-profiles/.clang-format
fi
- name: Check code style
run: |
SRC=$(git ls-tree --full-tree -r HEAD | grep -e "\.\(c\|h\|hpp\|cpp\)\$" | cut -f 2)
echo -e "Check source files: \n$SRC\n"
clang-format -style=file -i $SRC
if ! git diff --exit-code; then
echo -e "\nCode does not match required style !!!"
echo "Please use clang-format to format your code."
exit 1
else
echo "All files are properly formatted."
fi

0 comments on commit 31f5827

Please sign in to comment.