luisdue
luisdue

Reputation: 41

Plugin sbt-scalafmt fails downloading scalafmt-core in Github Actions

Im experiencing some issues with scalafmt. My problem is that when running scalafmtCheck, it tries to download dynamically scalafmt core. I followed the documentation https://scalameta.org/scalafmt/docs/installation.html#sbt , and i put my sbt plugin in version (2.4.6) and scalafmt conf in version (3.7.1) and still does not find the version i added in scalafmt conf, displaying something like:

[error] org.scalafmt.sbt.ScalafmtSbtReporter$ScalafmtSbtError: scalafmt: [v3.7.1] failed to download [/home/runner/work/pariplay-gateway/pariplay-gateway/.scalafmt.conf]
[error] (Compile / scalafmtCheck) org.scalafmt.sbt.ScalafmtSbtReporter$ScalafmtSbtError: scalafmt: [v3.7.1] failed to download [/home/runner/work/pariplay-gateway/pariplay-gateway/.scalafmt.conf]
[error] Total time: 8 s, completed Feb 21, 2023, 11:41:00 AM

My yaml file to run Github actions looks like this:

 test:
    env:
      SBT_CREDENTIALS: ".sbt/.credentials"
      SBT_NATIVE_CLIENT: true
    runs-on: [ubuntu-latest]
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
          ref: ${{ github.event.pull_request.head.sha }}

      - name: Coursier cache
        uses: coursier/cache-action@v6

      - name: Setup scala
        uses: olafurpg/setup-scala@v11
        with:
          java-version: ${{ inputs.javaVersion || '[email protected]' }}

      - name: Check formatting ๐Ÿ”
        run: sbt ";scalafix --check; scalafmtCheck"

      - name: Run tests ๐Ÿงช
        run: sbt test

I removed all cache in Github actions, is empty. So it should download all the deps at the first run. Locally it works but still failing in Github Actions.

Upvotes: 4

Views: 579

Answers (0)

Related Questions