From 5b0df9289878ee252a54c77e1c9424d5ba252fd1 Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Sun, 18 Feb 2024 09:46:08 +0000 Subject: [PATCH] Create a reusable workflow --- .github/workflows/ci-format.yml | 16 +--------------- .github/workflows/reusable-ci-format.yml | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/reusable-ci-format.yml 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