From e4532e996bb95464b7de8dc89cd127046701a328 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Tue, 17 Dec 2024 11:15:28 +0100 Subject: [PATCH 1/2] Use common lint formatter --- .github/workflows/lint-formatter.yml | 35 +--------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/.github/workflows/lint-formatter.yml b/.github/workflows/lint-formatter.yml index ac5620f16a..71dd5c184e 100644 --- a/.github/workflows/lint-formatter.yml +++ b/.github/workflows/lint-formatter.yml @@ -10,37 +10,4 @@ on: jobs: lint-formatter-job: - name: Auto-apply clang-format - - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - uses: greguintow/get-diff-action@v7 - with: - PATTERNS: | - include/**/*.h* - src/**/*.c* - - - name: Setup Python and pip - if: env.GIT_DIFF && !env.MATCHED_FILES # If nothing happens with python and/or pip after, the clean-up crashes. - uses: actions/setup-python@v5 - with: - python-version: 3.11.x - cache: 'pip' - cache-dependency-path: .github/workflows/requirements-linter.txt - - - name: Install Python requirements for runner - if: env.GIT_DIFF && !env.MATCHED_FILES - run: pip install -r .github/workflows/requirements-linter.txt - - - name: Format file - if: env.GIT_DIFF && !env.MATCHED_FILES - run: | - clang-format -i ${{ env.GIT_DIFF_FILTERED }} - - - uses: stefanzweifel/git-auto-commit-action@v4 - if: env.GIT_DIFF && !env.MATCHED_FILES - with: - commit_message: "Applied clang-format." + uses: ultimaker/cura-workflows/.github/workflows/lint-formatter.yml@main From dd8f8b8e446c063e0263dd6cc7012bf8f6bacd65 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Tue, 17 Dec 2024 11:20:38 +0100 Subject: [PATCH 2/2] Also trigger formatting on PR creation --- .github/workflows/lint-formatter.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-formatter.yml b/.github/workflows/lint-formatter.yml index 71dd5c184e..1c56380978 100644 --- a/.github/workflows/lint-formatter.yml +++ b/.github/workflows/lint-formatter.yml @@ -1,13 +1,17 @@ name: lint-formatter on: - workflow_dispatch: - push: paths: - 'include/**/*.h*' - 'src/**/*.c*' + pull_request: + types: [ opened ] + paths: + - 'include/**/*.h*' + - 'src/**/*.c*' + jobs: lint-formatter-job: uses: ultimaker/cura-workflows/.github/workflows/lint-formatter.yml@main