From 414a5e5ce0a39f94312ffddebf8b0f1b6e32bd91 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Oct 2023 18:49:31 -0700 Subject: [PATCH] Bump scalameta/scalafmt from 3.7.3 to v3.7.15 (#4790) * Bump scalameta/scalafmt from 3.7.3 to v3.7.15 Bumps scalameta/scalafmt from 3.7.3 to v3.7.15. --- updated-dependencies: - dependency-name: scalameta/scalafmt dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Create sync-scala-version.yaml * checkout on branch instead of headless * Update scala config version to match version installed * Add yaml header * rm EOL whitespace * remove useless cat cmds --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Zack Koppert Co-authored-by: zkoppert --- .github/workflows/sync-scala-version.yaml | 36 +++++++++++++++++++++++ Dockerfile | 2 +- TEMPLATES/.scalafmt.conf | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/sync-scala-version.yaml diff --git a/.github/workflows/sync-scala-version.yaml b/.github/workflows/sync-scala-version.yaml new file mode 100644 index 00000000..439983a1 --- /dev/null +++ b/.github/workflows/sync-scala-version.yaml @@ -0,0 +1,36 @@ +--- + +name: Sync scala format version between Dockerfile and config file + +on: + pull_request: + paths: + - 'Dockerfile' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + + - name: Sync the version if the dockerfile is getting updated + shell: bash + run: | + scala_version_from_dockerfile=$(grep 'scalameta/scalafmt' Dockerfile | awk -F: '{print $2}' | awk '{print $1}') + scala_version_from_dockerfile=${scala_version_from_dockerfile#v} + + scala_version_from_config=$(grep 'version =' TEMPLATES/.scalafmt.conf | awk -F= '{print $2}' | tr -d '[:space:]') + + echo "scala_version_from_dockerfile: $scala_version_from_dockerfile" + echo "scala_version_from_config: $scala_version_from_config" + + if [ "$scala_version_from_dockerfile" != "$scala_version_from_config" ]; then echo "versions differ"; sed -i "s/\(version =\).*/\1 ${scala_version_from_dockerfile}/g" TEMPLATES/.scalafmt.conf; fi + - uses: EndBug/add-and-commit@v9 # You can change this to use a specific version. + with: + add: 'TEMPLATES/.scalafmt.conf' + fetch: false + message: 'Update scala config version to match version installed' diff --git a/Dockerfile b/Dockerfile index 13242874..1476ef88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ FROM koalaman/shellcheck:v0.9.0 as shellcheck FROM mstruebing/editorconfig-checker:2.7.2 as editorconfig-checker FROM mvdan/shfmt:v3.7.0 as shfmt FROM rhysd/actionlint:1.6.26 as actionlint -FROM scalameta/scalafmt:v3.7.3 as scalafmt +FROM scalameta/scalafmt:v3.7.15 as scalafmt FROM zricethezav/gitleaks:v8.18.0 as gitleaks FROM yoheimuta/protolint:0.46.2 as protolint diff --git a/TEMPLATES/.scalafmt.conf b/TEMPLATES/.scalafmt.conf index 1172d8f5..212370ef 100644 --- a/TEMPLATES/.scalafmt.conf +++ b/TEMPLATES/.scalafmt.conf @@ -1,6 +1,6 @@ // Scala Format Configuration // https://scalameta.org/scalafmt/docs/configuration.html -version = 3.7.3 +version = 3.7.15 align.preset = more // For pretty alignment. maxColumn = 80 // https://scalameta.org/scalafmt/docs/configuration.html#scala-dialects