diff --git a/.github/workflows/ci-format.yml b/.github/workflows/ci-format.yml index 569bb95..343add7 100644 --- a/.github/workflows/ci-format.yml +++ b/.github/workflows/ci-format.yml @@ -1,6 +1,3 @@ -# This is a format job. Pre-commit has a first-party GitHub action, so we use -# that: https://github.com/pre-commit/action - name: Format on: @@ -9,15 +6,4 @@ on: jobs: pre-commit: - name: Format - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5.0.0 - with: - python-version: '3.10' - - name: Install system hooks - run: sudo apt install -qq cppcheck - - uses: pre-commit/action@v3.0.1 - with: - extra_args: --all-files --hook-stage manual + uses: ./.github/workflows/reusable-ci-format.yml diff --git a/.github/workflows/reusable-ci-format.yml b/.github/workflows/reusable-ci-format.yml new file mode 100644 index 0000000..e9f173e --- /dev/null +++ b/.github/workflows/reusable-ci-format.yml @@ -0,0 +1,24 @@ +name: Format +# This is a format job. Pre-commit has a first-party GitHub action, so we use +# that: https://github.com/pre-commit/action +# The pre-commit configuration is in .pre-commit-config.yaml + +on: + workflow_call: + +jobs: + pre-commit: + name: Format + runs-on: ubuntu-latest + env: + AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS: true + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5.0.0 + with: + python-version: '3.10' + - name: Install system hooks + run: sudo apt install -qq clang-format-14 cppcheck + - uses: pre-commit/action@v3.0.1 + with: + extra_args: --all-files --hook-stage manual