sbt / setup-sbt

MIT License
10 stars 2 forks source link

`sbt: not found` after `checkout` step #4

Closed paul-danilin-moia closed 6 days ago

paul-danilin-moia commented 6 days ago

Hi, thanks a lot for the action!

While migrating to it, an unexpected sbt: not found error was noticed if a checkout step is run after the setup-sbt. This github workflow should reproduce the issue:

name: Reproduce sbt not found

on:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-24.04
    steps:
    - name: Setup Java
      uses: actions/setup-java@v4
      with:
        distribution: "temurin"
        java-version: "21"
    - uses: sbt/setup-sbt@v1
    - uses: actions/checkout@v4
    - name: Check sbt
      run: sbt --version

The Check sbt step fails with sbt: not found error for me. Which is not the case e.g. for setup-java - you can call java afterwards. A quick glance showed that setup-sbt creates a directory to unpack sbt to in the working directory of the workflow. checkout on the other hand cleans the working directory.

What do you think about creating a directory for sbt somewhere outside of the working directory?

eed3si9n commented 6 days ago

What do you think about creating a directory for sbt somewhere outside of the working directory?

That makes total sense. Feel free to send a PR on this, if I don't get around to it soon.