From 1ca5139f28f0abec3c49736a47afe6b94a231858 Mon Sep 17 00:00:00 2001 From: Matthew de Detrich Date: Sat, 5 Nov 2022 15:53:07 +0100 Subject: [PATCH] Add github workflow to check scala code is formatted --- .github/workflows/build-test-prValidation.yml | 8 +++---- .github/workflows/format.yml | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/build-test-prValidation.yml b/.github/workflows/build-test-prValidation.yml index 8cdeb7e270..f1f53223d6 100644 --- a/.github/workflows/build-test-prValidation.yml +++ b/.github/workflows/build-test-prValidation.yml @@ -9,8 +9,8 @@ concurrency: cancel-in-progress: true jobs: - check-code-style: - name: Check / Code Style + check-headers: + name: Check / Headers runs-on: ubuntu-20.04 steps: - name: Checkout @@ -27,12 +27,12 @@ jobs: - name: Cache Coursier cache uses: coursier/cache-action@v6.2 - - name: Code style check + - name: Check headers run: |- sbt -jvm-opts .jvmopts-ci \ -Dsbt.override.build.repos=false \ -Dsbt.log.noformat=false \ - verifyCodeStyle + headerCheckAll pull-request-validation: name: Check / Tests diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000000..9ce98e557c --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,24 @@ +name: Scalafmt + +permissions: read-all + +on: + pull_request: + branches: ['**'] + +jobs: + build: + name: Code is formatted + runs-on: ubuntu-latest + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v2 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Check project is formatted + uses: jrouly/scalafmt-native-action@v2 + with: + version: '3.6.1' + arguments: '--list --mode diff-ref=origin/main'